heap-snapshot-analysis

Analyze V8 heap snapshots to diagnose memory leaks and trace object retention paths.

1|Updated Apr 8, 2026
One-click install
npx skills add https://github.com/voidful/Aixlarity --skill heap-snapshot-analysis-voidful
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: heap-snapshot-analysis
Source: https://github.com/voidful/Aixlarity/tree/main/aixlarity-ide/.github/skills/heap-snapshot-analysis
Command: npx skills add https://github.com/voidful/Aixlarity --skill heap-snapshot-analysis-voidful

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve? Memory leaks in JavaScript and TypeScript applications are hard to diagnose because objects silently survive garbage collection. This Skill parses large V8 .heapsnapshot files, compares before/after snapshots, and traces retainer paths so you can find exactly what keeps objects alive. ## Core Features & Use Cases - Snapshot Parsing: Buffer-based parsing handles .heapsnapshot files larger than 500MB that exceed JSON.parse string limits. - Before/After Comparison: Diff two snapshots to see top object groups by size increase, count increase, and newly created object groups. - Retainer Path Analysis: Trace non-weak reverse edges from target class instances to GC roots, skipping WeakMap red herrings. - Use Case: You capture heap snapshots before and after running a workflow in VS Code, then use this Skill to discover that disposed ChatModel instances are retained by a HoverService closure, and document the fix in a dated scratchpad findings file. ## Quick Start Analyze the two attached .heapsnapshot files to find which objects grew the most and trace what retains the leaked ChatModel instances.

Frequently Asked Questions about heap-snapshot-analysis

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

FAQPage Schema
How do I analyze a V8 heap snapshot file for memory leaks?

Parse the .heapsnapshot file with a Buffer-based parser, group nodes by constructor, and compare against a baseline snapshot. Then trace retainer paths from suspicious instances to GC roots using non-weak reverse edges to find what prevents collection.

How to compare two heap snapshots before and after a workflow?

Load both snapshots and group objects by type and constructor name, then compute count and size deltas per group. The comparison reports top groups by size increase, count increase, and object groups that only exist in the after snapshot.

Why does JSON.parse fail on large .heapsnapshot files?

Heap snapshots often exceed 500MB, surpassing V8's maximum string length, so JSON.parse throws. Buffer-based section extraction reads the meta, nodes, edges, and strings arrays directly from the file buffer without creating one giant string.

Why do WeakMap entries appear in retainer paths but not cause leaks?

WeakMap keys show up as weak edges from key to backing array in the snapshot graph, but weak references do not prevent garbage collection. Retainer analysis must skip weak edges, otherwise it reports false retainers that are red herrings.

What Node.js settings are needed to parse large heap snapshots?

Run analysis scripts with node --max-old-space-size=16384 to give the process enough heap for multi-hundred-megabyte snapshots. Typical analysis takes 30 to 120 seconds per snapshot depending on file size.