memory-leak-debugging

Diagnose JavaScript and Node.js memory leaks using heapsnapshots and memlab analysis.

1|Updated Apr 3, 2026
One-click install
npx skills add https://github.com/Pgooone/oh-pgone-claudecode --skill memory-leak-debugging-pgooone
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: memory-leak-debugging
Source: https://github.com/Pgooone/oh-pgone-claudecode/tree/main/.claude/plugins/cache/chrome-devtools-plugins/chrome-devtools-mcp/0.20.3/skills/memory-leak-debugging
Command: npx skills add https://github.com/Pgooone/oh-pgone-claudecode --skill memory-leak-debugging-pgooone

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires memlab, and includes references (resource) components.

What problem does it solve? JavaScript and Node.js applications suffering from high memory usage, OOM errors, or unexplained heap growth are hard to debug because raw heapsnapshot files are too large to inspect directly. This Skill provides structured workflows to capture, compare, and analyze memory snapshots to pinpoint leak sources. ## Core Features & Use Cases - Snapshot Capture Workflows: Guides interaction with web pages via chrome-devtools-mcp tools to take baseline, target, and final heapsnapshots that amplify leaks through repeated actions. - Memlab-Based Leak Detection: Uses memlab to automatically find leak retainer traces across three snapshots without reading raw heapsnapshot files. - Fallback Snapshot Comparison: Ships a Node.js script that compares two heapsnapshots and reports the top growing objects and common leak types when memlab is unavailable. - Use Case: A user reports their Node.js service hits OOM errors after hours of uptime. The Skill walks through capturing snapshots, running memlab find-leaks, and mapping retainer traces to common culprits like uncleared event listeners or unbounded caches. ## Quick Start Ask the assistant to investigate the memory leak in your web app by taking heap snapshots with chrome-devtools-mcp and analyzing them with memlab.

Frequently Asked Questions about memory-leak-debugging

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

FAQPage Schema
How do I find memory leaks in a JavaScript web application?▼

Capture three heap snapshots (baseline, target after the suspect action, and final after reverting it), then run memlab find-leaks on them. Memlab outputs retainer traces that point to the leaking objects in your codebase.

How to analyze .heapsnapshot files without running out of memory?▼

Never read raw .heapsnapshot files directly since they are extremely large. Use memlab commands like find-leaks or analyze snapshot, or run the compare_snapshots.js Node.js script to diff two snapshots and list top growing objects.

What are the most common causes of JavaScript memory leaks?▼

Common causes include uncleared event listeners, detached DOM nodes still referenced by variables, unintentional global variables, closures capturing large objects, and unbounded caches or arrays. Each has specific fixes like removeEventListener or using WeakMap.

Can I compare heap snapshots if memlab is not installed?▼

Yes, run the bundled compare_snapshots.js script with Node.js, passing the baseline and target snapshot paths. It outputs the top 10 growing objects by size and highlights common leak types like detached nodes and closures.

Why are detached DOM nodes not always memory leaks?▼

Detached DOM nodes are sometimes intentional caches, such as saved navigation trees. Always confirm with the user before nulling references, since removing them could break intended caching behavior.