kova-test-heap-leaks

Diagnose Vitest heap leaks by comparing heap snapshot deltas across worker lanes.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/chiragborse1/KovaLab --skill kova-test-heap-leaks
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kova-test-heap-leaks
Source: https://github.com/chiragborse1/KovaLab/tree/main/.agents/skills/kova-test-heap-leaks
Command: npx skills add https://github.com/chiragborse1/KovaLab --skill kova-test-heap-leaks

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill helps you investigate suspected heap leaks or memory growth during Kova’s pnpm/Vitest test runs using heap snapshots, so you can distinguish real cleanup bugs from snapshot noise or shared-worker retained module graphs.

Core Features & Use Cases

  • Reproduce with snapshot-friendly tracing: Guides you to run tests with KOVA_TEST_MEMORY_TRACE and scheduled heap snapshot collection to capture stable evidence over time.
  • Compare heap snapshots deterministically: Uses heapsnapshot-delta.mjs to compare two snapshots directly or automatically choose earliest/latest per PID in a given lane directory.
  • Triage by retained object families: Helps classify growth patterns (e.g., transformed-module retention vs runtime object/lifecycle leaks) and recommends how to validate conclusions with retainers/dominators.
  • Produce actionable fixes: Translates dominant evidence into concrete next steps such as lane isolation, hotspot updates, singleton isolation, or test/runtime cleanup patches.

Quick Start

Run the reproduce command for your failing lane with heap snapshots enabled, then use the provided delta script to compare the earliest/latest snapshots for the same PID in the lane directory.

Frequently Asked Questions about kova-test-heap-leaks

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I diagnose heap growth and OOM crashes in Vitest worker lanes?

Diagnose Vitest heap growth by capturing repeated heap snapshots across worker lanes and running a delta comparison script to identify dominant self-size entries for triage. This distinguishes real cleanup bugs from snapshot noise or retained module graphs.

Why are RSS spikes insufficient for finding memory leaks in Node.js test suites?

RSS spikes are insufficient for memory leak triage because they lack the granularity to distinguish true cleanup bugs from shared-worker retained module graphs. Heap snapshot metadata provides retained object families and dominator evidence needed for accurate diagnosis.

How do I compare heap snapshots to find retained object families in failing tests?

Compare heap snapshots by running the heapsnapshot-delta.mjs script against two snapshot files, or let it automatically select the earliest and latest snapshots per PID in a lane directory to classify growth patterns like transformed-module retention versus lifecycle leaks.

Can I triage memory leaks in a pnpm-based Vitest project using heap snapshot deltas?

Yes, you can triage memory leaks in pnpm-based Vitest projects by enabling KOVA_TEST_MEMORY_TRACE for scheduled heap snapshot collection, then comparing snapshot deltas to validate conclusions using retainers and dominators for actionable fixes.

What is the best way to fix suspected memory leaks found through heap snapshot triage?

The best way to fix suspected memory leaks is to translate dominant heap snapshot evidence into concrete next steps such as lane isolation, hotspot updates, singleton isolation, or test and runtime cleanup patches based on the identified growth patterns.

When should I not use heap snapshot deltas for test OOM debugging?

You should not use heap snapshot deltas for test OOM debugging when you cannot select the real test-parallel lane or PID shape, as accurate triage requires capturing repeated snapshots from the correct worker lane directory.