openclaw-test-heap-leaks

Compare V8 heap snapshots across time within the same Vitest worker PID to diagnose test-induced heap growth and worker OOM risk.

Updated Apr 8, 2026
One-click install
npx skills add https://github.com/JOHNNYWHITEMIKE/openclaw --skill openclaw-test-heap-leaks-johnnywhitemike
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: openclaw-test-heap-leaks
Source: https://github.com/JOHNNYWHITEMIKE/openclaw/tree/main/openclaw/.openclaw/openclaw/.agents/skills/openclaw-test-heap-leaks
Command: npx skills add https://github.com/JOHNNYWHITEMIKE/openclaw --skill openclaw-test-heap-leaks-johnnywhitemike

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill helps diagnose why OpenClaw’s test suite shows memory growth, including Vitest worker OOMs, by using heap snapshots to identify the retained object families driving the change.

Core Features & Use Cases

  • Snapshot-driven memory triage: Compare heap snapshots from the same worker PID to distinguish likely retained module graph growth from likely runtime cleanup or lifecycle leaks.
  • Lane-aware analysis workflow: Preserve the real test lane and shape (e.g., worker/shard/batch lane directories) so snapshot comparisons reflect the same execution context.
  • Actionable classification guidance: Route investigation toward either scheduling/hotspot isolation for transformed-module retention or cleanup logic and lifecycle fixes for genuine runtime leaks.
  • Deterministic delta reporting: Use the provided delta tool to surface the largest snapshot deltas (by self size) while applying thresholds to reduce noise.

Quick Start

Use openclaw-test-heap-leaks to investigate a suspected memory leak by running pnpm test with heap snapshot intervals enabled, then comparing before/after snapshots with heapsnapshot-delta.mjs for the specific lane directory and worker PID that reproduced the growth.

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 worker OOM risk using V8 heap snapshots?

Compare V8 heap snapshots across time within the same Vitest worker PID to identify retained object families driving memory growth. Use the provided delta tool to surface the largest snapshot deltas by self size while applying thresholds to reduce noise and isolate genuine leaks.

What causes test-induced heap growth in Node.js parallel test lanes?

Test-induced heap growth in parallel test lanes is typically caused by either shared-worker retained transformed modules or real runtime cleanup and lifecycle leaks. Comparing V8 heap snapshots from the same worker PID helps distinguish between scheduling hotspot retention and genuine cleanup logic failures.

How do I compare heap snapshots to find memory leaks in a Vitest worker?

Run tests with heap snapshot intervals enabled, then use heapsnapshot-delta.mjs to compare snapshots from the specific lane directory and worker PID that reproduced the growth. Apply retention and dominator confirmation to validate the identified object families driving the leak.

Do I need lane-aware isolation to triage Node.js test memory leaks?

Yes, lane-aware isolation is required because it preserves the real test lane and shape, such as worker, shard, or batch lane directories. This ensures snapshot comparisons reflect the same execution context and prevents cross-lane data contamination.

What is the best way to classify retained module graph growth versus runtime lifecycle leaks?

Compare V8 heap snapshots across time within the same worker PID to classify the leak source. Route investigation toward scheduling or hotspot isolation for transformed-module retention, or toward cleanup logic and lifecycle fixes for genuine runtime leaks.