enclawed-test-heap-leaks

Compare repeated heap snapshots to diagnose Vitest worker memory leaks.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill helps diagnose test-suite memory growth, Vitest worker out-of-memory failures, and suspicious RSS increases in Enclawed so you can tell the difference between a real leak and retained worker-lifetime state.

Core Features & Use Cases

  • Heap snapshot triage: Compare repeated .heapsnapshot files from the same worker PID to identify what is growing over time.
  • Leak classification: Separate retained transformed-module growth from runtime-object leaks, cleanup bugs, timers, listeners, and other lifecycle issues.
  • Targeted remediation: Use the results to patch cleanup logic, isolate hotspot tests, or adjust lane scheduling and worker placement.
  • Use case: A pnpm test run starts OOMing in CI, and this Skill guides the reproduction command, snapshot comparison, and fix path with evidence instead of guesswork.

Quick Start

Ask the assistant to reproduce the failing test lane with heap snapshots enabled, compare repeated snapshots from the same PID, and summarize whether the growth is likely a real leak or shared-worker module retention.

Frequently Asked Questions about enclawed-test-heap-leaks

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

FAQPage Schema
How do I debug Vitest worker out-of-memory failures in CI?

Debug Vitest worker out-of-memory failures by reproducing the failing test lane with heap snapshots enabled, then comparing repeated snapshots from the same worker PID to classify the growth as a real leak or retained module state.

Why does RSS growth keep spiking during long-running pnpm test lanes?

RSS growth spikes during long-running test lanes often stem from retained transformed-module growth, cleanup bugs, or lingering timers and listeners that this Skill isolates using same-worker PID heap snapshot deltas.

What is the best way to compare heap snapshots to find test memory leaks?

The best way to find test memory leaks is comparing repeated .heapsnapshot files from the same worker PID to confirm retainers or dominators, revealing whether the growth is a runtime-object leak or shared-worker retention.

Can I use heap snapshot triage to separate real leaks from worker-lifecycle state?

Heap snapshot triage separates real leaks from worker-lifecycle state by analyzing retainer and dominator confirmation across snapshot deltas, distinguishing runtime-object leaks from retained transformed-module growth.

How do I fix test memory leaks after identifying the hotspot?

Fix test memory leaks by patching cleanup logic, isolating hotspot tests into separate lanes, or adjusting worker placement and lane scheduling based on the confirmed retainer evidence from the snapshot comparison.

Vitest test memory growth not working as expected, what are the limitations?

A key limitation of Vitest test memory growth analysis is the requirement for heap snapshot deltas and accurate lane and PID selection, as comparing snapshots across different worker PIDs leads to inconclusive triage.