heap-snapshot-analysis

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

Updated Aug 20, 2026
One-click install
npx skills add https://github.com/basedgod55hjl/vsbrax --skill heap-snapshot-analysis-basedgod55hjl
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: heap-snapshot-analysis
Source: https://github.com/basedgod55hjl/vsbrax/tree/main/.github/skills/heap-snapshot-analysis
Command: npx skills add https://github.com/basedgod55hjl/vsbrax --skill heap-snapshot-analysis-basedgod55hjl

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve? Investigating memory leaks in Node.js and VS Code-style applications requires parsing massive .heapsnapshot files that often exceed JSON.parse limits, and manually tracing why objects survive garbage collection is slow and error-prone. ## Core Features & Use Cases - Snapshot Parsing & Comparison: Load large V8 heap snapshots with Buffer-based or streaming parsers, then diff before/after snapshots to surface object groups growing by count or size. - Retainer Path Tracing: Find what keeps specific class instances alive by walking non-weak reverse edges to GC roots, filtering out WeakMap red herrings. - Large Snapshot Streaming: Handle snapshots over 2 GiB with chunked streaming primitives that scan nodes, edges, and strings without loading the full file into memory. - Use Case: Given before/after .heapsnapshot files from a chat session workflow, compare object deltas, identify that ChatModel instances are retained, and trace the retainer path back to a resource pool or closure that failed to release them. ## Quick Start Ask the agent to compare the before and after heap snapshots in your workspace and trace what is retaining 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 for memory leaks?▼

Parse the .heapsnapshot file with the provided helpers, compare before/after snapshots to find object groups growing in count or size, then trace retainer paths for suspicious classes. Retainer analysis walks non-weak reverse edges to GC roots to show what keeps objects alive.

How to compare two heap snapshots in Node.js?▼

Use the compareSnapshots helper with the before and after file paths. It groups nodes by constructor name and reports top increases by size and count, plus object groups that only exist in the after snapshot.

Why does parsing a large heapsnapshot file fail with ERR_FS_FILE_TOO_LARGE?▼

Node cannot create a Buffer larger than roughly 2 GiB, so full-file reads fail on very large snapshots. Switch to the streaming helpers that scan section offsets and process nodes and edges in chunks instead of loading everything into memory.

What edge types prevent garbage collection in V8 heap snapshots?▼

Property, element, context, internal, and hidden edges all prevent collection. Weak edges from WeakRef or WeakMap keys do not prevent GC and must be skipped when tracing retainer paths, since they appear in paths but are red herrings.

Can DevTools cause false retainer paths in heap snapshots?▼

Yes. Snapshots captured after opening DevTools can show large strings and objects retained through DevTools debugger global handles and synthetic GC roots. Treat these as debugger-induced until proven otherwise, since they may not exist before DevTools opens.