memory-leak-debug
Skill by QwenLM
Diagnoses memory leaks in the Qwen Code CLI using heap snapshots and the chrome-devtools CLI. Built for developers investigating high memory use, unbounded growth, or object retention.
Install memory-leak-debug
Built from the published package, never by AI.
git clone --depth 1 https://github.com/QwenLM/qwen-code /tmp/qwen-code && mkdir -p ~/.claude/skills && cp -r /tmp/qwen-code/.qwen/skills/memory-leak-debug ~/.claude/skills/memory-leak-debugRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/QwenLM/qwen-code /tmp/qwen-code && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/qwen-code/.qwen/skills/memory-leak-debug ~/.gemini/antigravity-cli/skills/memory-leak-debugAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
The memory-leak-debug skill guides an AI assistant through finding memory leaks in the Qwen Code Node.js CLI. It starts the CLI with the --heapsnapshot-signal flag, then captures heap snapshots by sending SIGUSR2 at intervals while the CLI is exercised through tmux.
Snapshots are analyzed with the chrome-devtools CLI in file-analysis mode, so no browser is needed. The skill summarizes heap size, lists class-level counts and retained sizes, inspects instances, and traces retainer chains to find what holds objects alive. It suggests common causes such as unbounded buffers, listener leaks, closures and module-level caches. It is aimed at developers who see high memory usage, unbounded growth, or suspected object retention in the CLI.
Written from the project's SKILL.md and checked against it.
What it can do
- Heap snapshot captureStarts the Qwen Code CLI with a signal flag and takes snapshots at intervals using SIGUSR2.
- load_memory_snapshotLoads a .heapsnapshot file and returns total heap size, V8 heap breakdown and node count.
- get_memory_snapshot_detailsReturns class-level aggregates as CSV with count, selfSize and maxRetainedSize.
- get_nodes_by_classLists individual instances of a class with their id, retainedSize and nodeIndex.
- get_node_retainersShows the retainer chain that keeps a given object alive.
- Root cause guidanceDescribes common leak patterns such as unbounded arrays, listener leaks and module-level caches.
- Fix verificationRepeats the snapshot workflow after a fix to confirm the leaking class count stabilizes.
What you need
- Node.js 22 or later
- chrome-devtools CLI from the chrome-devtools-mcp package
- tmux for driving the CLI TUI
Try asking
- Help me find out why Qwen Code memory keeps growing during a long session.
- Take heap snapshots of the Qwen Code CLI and compare class counts between them.
- Trace the retainer chain for the objects leaking in my latest heap snapshot.
Good to know
- Snapshot signal support requires Node.js 22 or later.
- The chrome-devtools memory tools work only on .heapsnapshot files, not on a live Node connection.
- Shell environment variables do not persist between separate tool calls.
- Verifying a fix requires rebuilding with npm run bundle.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: .qwen/skills/memory-leak-debug/SKILL.md, .qwen/skills/memory-leak-debug/scripts/find-leaf-node.sh. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md5 KB -
examples/react-reconciler-performance-measure-leak.md2 KB -
scripts/find-leaf-node.sh405 B
Alternatives to memory-leak-debug
All alternatives →Antigravity Workflows guides an assistant through multi-skill workflows for shipping a SaaS MVP, auditing web app security, building AI agents, running browser QA, and designing a domain model. It is for users who want several skills combined with verified checkpoints.
Guides building end-to-end test suites with Playwright and Cypress. It is for developers who write E2E tests, debug flaky tests, or set testing standards.
Upgrades Chrome or Firefox versions in the Flutter Web Engine and Framework tests. It verifies the version, updates config files, syncs CI builder JSON and runs local tests before the CIPD upload.
Builds reliable browser checks for real web workflows using semantic locators, bounded waits, isolated test data and explicit outcome checks. It is for developers and testers writing or debugging browser tests.
Guides an assistant through using Claude in Chrome, a browser extension whose tools act in the person's real Chrome with their own sign-ins. It is for users who want the assistant to work in their browser safely.
Automates a browser through the playwright-cli command line for web testing, form filling, screenshots, and data extraction. Built for AI assistants that need to navigate sites and interact with web pages.
Compare with antigravity-workflows, e2e-testing-patterns or upgrade-browser
memory-leak-debug: common questions
Which tools does the memory-leak-debug skill use?
It uses the chrome-devtools CLI from the chrome-devtools-mcp package to analyze snapshots. It also uses the tmux-real-user-testing helper script to drive the CLI.
How does the skill confirm a leak?
It compares class counts and retained sizes across snapshots taken at intervals. Classes whose count or retained size keeps growing with activity point to a leak.
Can it analyze the production bundle instead of the dev source?
Yes. The skill says to run npm run bundle and then start dist/cli.js with the --heapsnapshot-signal=SIGUSR2 flag.
How do I install memory-leak-debug?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is memory-leak-debug free?
The code is published under the Apache-2.0 licence. The service it connects to may have its own pricing.
Is memory-leak-debug safe to use?
It scores 94 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to memory-leak-debug?
Similar skills: antigravity-workflows, e2e-testing-patterns, upgrade-browser, browser-automation.
