Analyze V8 heap snapshots to find memory leaks and object retention.
Copy the install command and let the AI configure it · recommended for beginners
Please install the "heap-snapshot-analysis" skill from askskill: 1. Download https://raw.githubusercontent.com/microsoft/vscode/main/.github/skills/heap-snapshot-analysis/SKILL.md 2. Save it as ~/.claude/skills/heap-snapshot-analysis/SKILL.md 3. Reload skills and tell me it's ready
Please analyze these two .heapsnapshot files, compare object count and memory size changes, identify the object types with the biggest growth, and explain possible leak directions.
A diff analysis listing growing object types, size changes, and suspicious leak clues.
I suspect some disposed objects are still referenced. Please trace their retainer paths in the heap snapshot and find what is preventing them from being released.
A retainer-chain explanation identifying key reference paths and the holder preventing garbage collection.
Please inspect this heap snapshot, analyze why certain objects survive after GC, and suggest the next troubleshooting steps.
An analysis of surviving objects, including likely reference sources, grouped findings, and recommended next steps.
Once .heapsnapshot files are available, developers can use this skill to analyze heap growth and locate likely memory leak sources. It is especially useful for comparing snapshots taken before and after a workflow.
When objects that should be disposed are still present, retainer-path analysis helps identify what is holding them. This is useful for retention issues caused by listeners, caches, or closures.
For very large .heapsnapshot files, the parsing and streaming helpers can read only the needed sections instead of loading the whole file. This fits large-scale memory investigations.
The documentation explains how to investigate V8 heap snapshots when .heapsnapshot files already exist. It covers comparing snapshots, grouping object deltas, tracing retainer paths, and understanding why objects survive garbage collection. It also describes helper scripts for parsing and graph building, and notes that very large files may require streaming-based scripts instead of full-file loading because of Buffer size limits.
Investigate memory leaks from V8 heap snapshots (.heapsnapshot files). This skill starts when snapshots already exist: either the user provided them, DevTools exported them, or another workflow produced them. Use the helpers here to compare snapshots, group object deltas, and trace retainer paths.
Start every investigation fresh. Do NOT read, consult, or be influenced by prior investigations found in:
/memories/ (user, session, or repo memory).github/skills/heap-snapshot-analysis/scratchpad/ (previous dated subfolders and their findings.md files)Previous findings can bias the analysis toward suspects that are no longer relevant, or cause the agent to skip steps and jump to conclusions. Let the current snapshots speak for themselves. Only reference prior work if the user explicitly asks you to.
.heapsnapshot files (before/after a workflow)If the user needs the agent to launch VS Code, drive a scenario, and capture snapshots first, use the VS Code performance workflow skill before returning here for low-level snapshot analysis.
Use the helpers in parseSnapshot.ts to load snapshots. The files are often >500MB and too large for JSON.parse as a string — the helpers use Buffer-based extraction. In scratchpad scripts, import helpers from ../helpers/*.ts.
For very large snapshots, the helper may still be too eager. Node cannot create a Buffer larger than roughly 2 GiB, so snapshots above that size can fail with ERR_FS_FILE_TOO_LARGE even before parsing. In that case, do not try to raise --max-old-space-size and retry the same full-file read. Switch to a streaming script.
import { parseSnapshot, buildGraph } from '../helpers/parseSnapshot.ts';
const data = parseSnapshot('/path/to/snapshot.heapsnapshot');
const graph = buildGraph(data);
When a snapshot is too large to load into a single Buffer, write scratchpad scripts that scan and parse only the sections needed for the question. Use streamSnapshot.mjs for the common streaming primitives instead of copying them between scratch scripts.
Useful tricks:
"nodes":, "edges":, "strings":, and "trace_function_infos":. This lets follow-up scripts jump directly to the large arrays instead of searching the whole file repeatedly.snapshot.meta separately from the small header at the start of the file. Use meta.node_fields, meta.node_types, meta.edge_fields, and meta.edge_types to avoid hard-coding tuple widths.nodes and edges, keep a small carryover string between chunks, split on commas, and process complete numeric tokens as they arrive.strings table unless the investigation truly needs it. If you only need suspicious names, collect string indexes from matching nodes/edges first, then resolve only those indexes in a second streaming pass.…
It analyzes V8 .heapsnapshot files to investigate memory leaks, object retention, and why objects survive GC. It also supports snapshot comparison, retainer-path analysis, and helper-based parsing.
You need existing .heapsnapshot files, either provided by the user, exported from DevTools, or produced by another workflow. If snapshots still need to be captured, the docs suggest using the VS Code performance workflow skill first.
Not always. The docs note that snapshots are often over 500MB, and files above roughly 2 GiB can fail because of Buffer limits. In that case, you should switch to streaming scripts instead of just increasing memory and retrying.
Run chat performance benchmarks and memory leak checks for VS Code builds.
Update the GitHub Copilot CLI or SDK to a newer version.
Find and read Code OSS dev build logs for faster debugging.
Generate or update chat customization files for AI coding agents.
Validate Azure DevOps pipeline changes and troubleshoot builds and YAML faster.
Merge session branch changes back into the base branch cleanly.
Answer metric questions, analyze trends, compare segments, and draft data reports.
Analyze memory dumps for forensic investigations with fast, plugin-rich workflows.
Automate VS Code performance and memory investigations with repeatable evidence capture.
Analyze Windows crash dumps and safely support patch, build, and test workflows.
Analyze hermesvm binary size changes and regressions across commit ranges.
Scan JS/TS files for event-listener leaks and generate validated fixes.