openclaw-test-heap-leaks
Investigate and resolve OpenClaw test memory leaks, Vitest OOMs, and RSS growth using heap snapshots.
Introduction
The openclaw-test-heap-leaks skill provides a systematic approach for diagnosing memory instability within the OpenClaw repository testing environment. Designed for engineers facing Out-Of-Memory (OOM) errors, RSS spikes, or consistent memory growth during Vitest test runs, this skill automates the capture and analysis of heap snapshots. It helps differentiate between infrastructure-related module-graph retention in long-lived test workers and actual application-level object leaks. By utilizing specific environment flags and automated comparison scripts, developers can isolate failing test lanes, identify problematic test fixtures, and apply targeted fixes.
-
Capture heap snapshots during CI-style or local test execution using pre-configured interval settings.
-
Automated delta analysis between multiple heap snapshots to pinpoint object growth in memory.
-
Integration with node-based helper scripts to parse and compare memory usage per worker PID.
-
Distinguishes between Vitest/Vite transformed-module retention and runtime app-object leaks (e.g., caches, listeners, DB handles).
-
Diagnostic workflow for identifying 'hotspot' files that negatively impact worker memory budgets.
-
Use this skill when test suites exhibit non-deterministic failures or process termination under load.
-
Prioritize the isolation of identified memory-heavy tests into dedicated lanes using test-parallel behavior configurations.
-
Always confirm findings from delta analysis by inspecting retainers and dominators in browser DevTools before modifying code.
-
Ensure environment variables like OPENCLAW_TEST_MEMORY_TRACE and OPENCLAW_TEST_HEAPSNAPSHOT_DIR are properly exported for full diagnostic coverage.
-
Expected inputs include test suite names, shard/lane identifiers, and raw .heapsnapshot files; output provides a clear diagnosis of the leak type and a recommended path for architectural cleanup or test isolation.
Repository Stats
- Stars
- 366,735
- Forks
- 75,309
- Open Issues
- 6,821
- Language
- TypeScript
- Default Branch
- main
- Sync Status
- Idle
- Last Synced
- Apr 30, 2026, 04:53 PM