Heap Snapshot Analyzer for Node and Chrome

Drop a .heapsnapshot file to see constructors and node types by shallow bytes, duplicate strings and detached DOM nodes. Parsed locally, never uploaded.

The interactive tool loads here when JavaScript runs.

About this tool

What is the Heap Snapshot Analyzer?

Drop a .heapsnapshot file, from the Chrome DevTools Memory panel, node --heapsnapshot-signal or v8.writeHeapSnapshot(), and this tool summarises the V8 heap it captures: node and constructor histograms by shallow bytes, the biggest single nodes, strings stored more than once with the bytes they waste, and the count of detached DOM nodes, the classic browser leak.

A V8 snapshot is self-describing JSON: snapshot.meta names the fields each flat nodes[] row carries. The parser reads that layout from the file instead of assuming one, which is why snapshots from old Chrome versions, current Node and worker threads all parse, including files whose rows gained the detachedness field over the years.

The file is parsed in this tab and never uploaded. Snapshots embed every string in the heap, request bodies, tokens and URLs included, so that privacy property is the reason this page exists.

  • Reads the row layout from snapshot.meta, so old Chrome and current Node files both parse
  • Node-type and constructor histograms by shallow bytes
  • Detached DOM node count surfaced as a verdict, not a footnote
  • Duplicate string detection with exact wasted bytes
  • Ten biggest single nodes with type and name
  • Copyable text summary for tickets and diffs
  • Runs entirely in your browser; the snapshot is never uploaded
Read the guide: How to Capture and Read Heap Dumps and Thread Dumps

Updated

How to use the Heap Snapshot Analyzer

  1. Capture a snapshot. Chrome: DevTools, Memory panel, Heap snapshot, Take snapshot, then right-click it to save the .heapsnapshot file. Node: start with --heapsnapshot-signal=SIGUSR2 and send kill -USR2 <pid>, or call v8.writeHeapSnapshot() in code. Automatic snapshots near the heap limit, the inspector route and Kubernetes are in the guide to taking a Node.js heap snapshot (/blog/how-to-take-a-node-heap-snapshot).
  2. Drop the file on the page. It is one JSON document, so it is read whole; a note shows while a big file reads and parses.
  3. Read the totals: node count, edge count, total shallow bytes, and the detached DOM node count if any.
  4. Scan the constructor chart: your own class names with unexpectedly high counts are the lead. In Node, rows like Socket, TLSSocket or IncomingMessage that grow between snapshots point at connections never released.
  5. Check the duplicate strings: copies of the same long string name the payload being re-parsed or re-built.

Worked examples

A five-node snapshot, read from its own meta

Input

A synthetic snapshot: two Cache objects (48 B each), one string stored twice (40 B each), one detached element (64 B)

Output

5 nodes, 240 B shallow; constructors: Cache 2 × 96 B; detached DOM nodes: 1

The fixture declares its own node_fields layout including detachedness, exactly as real files do; the parser reads the layout rather than assuming column positions, and the test suite pins every figure.

Duplicate strings with the waste priced

Input

The fixture's string "duplicate-duplicate-x" (21 chars) stored twice

Output

duplicate strings: 2 copies, 40 B beyond the first

One copy must stay, so waste counts the second copy's 40 bytes. On a real Node service the same pattern shows up as thousands of copies of a config or query string, where the figure reaches megabytes.

Detached DOM nodes flagged as the leak signal

Input

A node whose detachedness field is 1: "Detached HTMLDivElement"

Output

detached DOM nodes: 1, highlighted above the histograms

The element was removed from the document but JavaScript still references it, so V8 cannot free it or its subtree. In DevTools these appear under the Detached filter; here they are counted up front.

Background and insight

Sizes shown are V8's self_size, what the DevTools Memory panel calls shallow size: per Chrome's memory documentation, the memory held by the object itself. Retained size, the memory freed once the object is deleted together with everything only it referenced, needs the dominator tree over every edge in the graph. This summary leaves that computation out on purpose and labels every figure shallow, so a number here is never mistaken for a DevTools retained column. Chrome's docs also note strings and external arrays often keep their main storage in renderer memory outside the JS heap, which is why a page using hundreds of MB can show a smaller snapshot total.

Detachedness is a per-node field V8 writes for DOM nodes that are no longer in the document but still reachable from JavaScript. DevTools surfaces them under its "Detached" filter because, as its heap snapshot guide puts it, leaks commonly come from detached DOM subtrees held by forgotten references. The count here is the same signal without opening DevTools: more than a handful after the page has settled means listeners, caches or closures are holding removed elements.

Duplicate strings are found by exact content for strings of 16 characters or more. Repeated JSON fragments, SQL text or header values at scale mean something is parsed or built per request that could be built once. The waste figure counts every copy beyond the first, using each copy's self_size.

Common use cases

  • Node service RSS climbing between deploys

    Snapshot twice some minutes apart with --heapsnapshot-signal and compare constructor counts; the row that only grows is the leak, long before the OOM killer acts.

  • Single-page app slows down over hours

    Take a snapshot after heavy navigation: a detached-node count in the hundreds means views are removed from the DOM but held by listeners or a router cache.

  • A snapshot from a user or CI machine

    Summarise a .heapsnapshot attached to a ticket without loading it into DevTools or sending it to anyone; the text summary pastes straight back into the ticket.

  • Payload hygiene before optimising code

    The duplicate-string list prices redundant JSON and SQL text in bytes, which is often the cheapest memory win in an Express or Fastify service.

  • Before and after a fix

    Keep the text summaries from both runs and diff them: constructor counts and the detached figure are the regression check.

Tips and limitations

  • Capture at a quiet moment: both DevTools and V8 collect garbage before writing, so a snapshot mid-burst mostly shows live traffic, not the leak.
  • Per the Node docs, writing a snapshot is synchronous, blocks the event loop and needs memory around twice the heap at that moment; do not signal a process that is already near its limit, and prefer --heapsnapshot-near-heap-limit=3 to catch it earlier.
  • Compare two snapshots rather than reading one: a cache legitimately holds 50,000 objects; a leak is the count that grows without bound. Numbers that only ever rise between summaries are the lead.
  • The (string), (compiled code) and hidden rows are V8 internals. High system-type bytes right after startup settle as code caches warm; your own constructor names are the actionable rows.
  • A very large snapshot is one JSON document, so unlike the streaming .hprof tool this page must hold the text in memory while parsing; files beyond a gigabyte can exceed a tab's string limits. Capture with exposeNumericValues off and summarise, or fall back to DevTools.
  • Retained size and "what keeps this alive" need the DevTools Memory panel or a dominator analysis; this page tells you which constructor to chase, not who owns it.

Sources and further reading

  1. Command-line API: --heapsnapshot-signal, Node.js. Writing a snapshot on a signal, and --heapsnapshot-near-heap-limit
  2. V8 module: v8.writeHeapSnapshot(), Node.js. On-demand snapshots, the default file name, and the memory and blocking caveats
  3. Memory terminology, Chrome for Developers. Shallow versus retained size, and where string storage lives
  4. Record heap snapshots, Chrome for Developers. Taking snapshots in the Memory panel and the Detached nodes filter

Frequently asked questions

Is a heap snapshot safe to share or upload?

Treat it like a memory image: it contains every string in the heap, which can include tokens, cookies, request bodies and personal data. This page parses it locally and transmits nothing, which is the safe default; be deliberate before attaching one to a public issue.

What does shallow size mean in a heap snapshot?

It is V8's self_size: the memory the object itself holds, per Chrome's memory documentation. It excludes everything the object references. A Map with shallow size of a few dozen bytes can retain gigabytes; retained size needs the dominator tree, which DevTools computes and this summary deliberately does not.

How do I take a heap snapshot of a running Node process?

Start it with --heapsnapshot-signal=SIGUSR2, then kill -USR2 <pid> writes a Heap.*.heapsnapshot file next to the process. In code, v8.writeHeapSnapshot() does the same on demand, and --heapsnapshot-near-heap-limit=N writes up to N snapshots automatically as the heap approaches its limit.

What is a detached DOM node and why does it leak?

An element removed from the document that JavaScript still references, through a listener, closure or cache. The GC cannot free it, and it pins its whole subtree. V8 marks such nodes in the snapshot's detachedness field; a count that grows with use is a leak in UI code, not in the framework.

Why is my snapshot total smaller than the memory the process uses?

The snapshot covers the V8 JS heap. Buffers, external strings and array backing stores can live outside it, Chrome's docs note string storage often sits in renderer memory, and a Node process also carries native memory, code and stacks. Compare the snapshot with process.memoryUsage() to see the split.

Does this work with snapshots from Chrome DevTools, workers and old versions?

Yes. The file starts with snapshot.meta describing its own row layout, and the parser follows that description instead of hard-coding offsets, so files with or without the detachedness field, from browsers or Node worker threads, read the same way.

Is there an in-depth guide to the Heap Snapshot Analyzer?

Yes. “How to Capture and Read Heap Dumps and Thread Dumps” covers the background, how it works, common pitfalls and worked examples. Read the full guide.