openclaw-test-heap-leaks

Diagnose Vitest worker memory growth by diffing V8 heap snapshots across test lanes.

Updated Jun 19, 2026
One-click install
npx skills add https://github.com/AmirulAndalib/Vilvona-AI --skill openclaw-test-heap-leaks-amirulandalib
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: openclaw-test-heap-leaks
Source: https://github.com/AmirulAndalib/Vilvona-AI/tree/main/.agents/skills/openclaw-test-heap-leaks
Command: npx skills add https://github.com/AmirulAndalib/Vilvona-AI --skill openclaw-test-heap-leaks-amirulandalib

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve? Test suites running under Vitest can hit out-of-memory failures and unexplained RSS growth, and guessing from RSS alone often misidentifies the cause. This Skill provides a structured workflow to reproduce the failing test shape, capture repeated heap snapshots per worker PID, and classify whether growth comes from retained transformed modules or genuine application object leaks. ## Core Features & Use Cases - Heap Snapshot Diffing: Compare two .heapsnapshot files directly or auto-select the earliest/latest pair per PID within a lane directory using the bundled heapsnapshot-delta.mjs script. - Leak Classification Heuristics: Distinguish retained Vite/Vitest transformed-module growth from real lifecycle leaks involving caches, timers, DB handles, or listeners. - Fix Guidance: Apply timing-driven scheduling fixes, singletonIsolated lane peeling, or targeted cleanup patches, then verify with snapshot re-runs or RSS trends. - Use Case: A CI unit-test lane OOMs at 6GB. You reproduce it with heap snapshots enabled, diff snapshots per PID, find transformed-module retention dominates, and peel the hotspot file into an isolated lane. ## Quick Start Ask the agent to investigate the Vitest test memory growth by reproducing the failing lane with heap snapshots enabled and diffing the snapshots with the heapsnapshot-delta script.

Frequently Asked Questions about openclaw-test-heap-leaks

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

FAQPage Schema
How do I diagnose Vitest out-of-memory errors in test workers?

Reproduce the failing lane with heap snapshots enabled via OPENCLAW_TEST_HEAPSNAPSHOT_DIR, then diff the earliest and latest snapshots per worker PID using the heapsnapshot-delta.mjs script. The top positive deltas reveal whether growth comes from transformed modules or runtime objects.

How to compare two V8 heap snapshots from the command line?

Run node heapsnapshot-delta.mjs before.heapsnapshot after.heapsnapshot to print the top positive size deltas by object type and name. Use --lane-dir to auto-select the earliest and latest snapshots per PID, with --top and --min-kb to filter output.

Why does RSS keep growing in Vitest unit test lanes?

Growth is often retained Vite/Vitest transformed-module state in long-lived shared workers rather than a true application leak. Confirm by checking whether deltas are dominated by Module, Context, or source strings versus app objects, timers, or DB handles.

Can heap snapshot deltas alone prove a memory leak?

No, snapshot-name deltas are triage evidence, not proof. Ambiguous cases should be confirmed by inspecting retainers and dominators in Chrome DevTools for the top delta entries before declaring a root cause.

When should I isolate a test file into its own Vitest lane?

Isolate a file with singletonIsolated when it inflates shared worker heaps but runs safely alone, and only after timing-driven scheduling fixes are insufficient. Check whether the file is missing from the test timings fixture, since absent timings are a scheduling blind spot.