What problem does it solve?
Tracking down memory leaks in a Node.js CLI application is difficult without a repeatable workflow: heap grows silently, and identifying which objects are retained and why requires specialized tooling. This Skill provides a step-by-step procedure to capture heap snapshots from the Qwen Code CLI and analyze retained objects to pinpoint the leak's root cause.
Core Features & Use Cases
- Heap Snapshot Capture: Launch the CLI with
--heapsnapshot-signal=SIGUSR2 inside tmux and trigger snapshots at intervals with kill -USR2 to compare memory growth over time.
- Retained Object Analysis: Use the
chrome-devtools CLI to load snapshots, get class-level aggregates with retained sizes, inspect leaking instances, and trace retainer chains to the root retention path.
- Fix Verification Workflow: Re-run the same workload after a fix and confirm the leaking class count stabilizes instead of growing with activity.
- Use Case: After an ink 7 upgrade caused ~143 MB of
PerformanceMeasure object retention, this workflow traced the leak to react-reconciler's dev build calling performance.measure() on every render, fixed by setting NODE_ENV=production in the esbuild config.
Quick Start
Ask the agent to diagnose high memory usage in the Qwen Code CLI by capturing heap snapshots and analyzing them with the chrome-devtools CLI.