Skip to main content

Heap dump fundamentals

A heap dump is a snapshot of recorded objects and relationships—not allocation history, a CPU profile, or proof that an object is obsolete. HeapLens builds a reference graph and derives modeled sizes and ownership locally.

Fresh analysis with staged results
Local analysis · clear boundaries
  1. Read recordsMap the capture · partial record counts
  2. Show shallow resultsOverview and Histogram · retained unavailable
  3. Build referencesRetaining edges · Memory or Disk storage
  4. Show retained resultsDominators · suspects · object actions

Full analysis continues after shallow results. Quick Scan stops before graph work until Analyze Retained is chosen. Waste is a separate request after full analysis. Motion is illustrative, not measured timing. No analysis or network request runs here.

What is recorded?​

Class layouts distinguish references from primitive fields. Instances/arrays carry opaque IDs and contents. GC-root records supply reachability entry points. Some format variants provide heap-type information and extended roots.

The serialized ID width does not prove the JVM's physical reference width. The HPROF format header is not a reliable Java release number: JAVA PROFILE 1.0.2 alone cannot identify JDK 27. Compatibility depends on supported records/layouts and fixtures. OpenJ9 PHD is a different format; renaming it does not convert it. Android records do not establish universal JVM/Android-version coverage.

Four different sizes​

QuantityMeaning
File bytesSerialized HPROF length
Total modeled heapSum of shallow sizes, including recorded unreachable objects
Reachable modeled heapShallow bytes reachable in the retaining graph
Analyzer RSSResident mapped pages plus analysis/process allocations

Memory mapping avoids an eager application-buffer copy. It does not consume zero RAM or eliminate graph memory requirements.

Interpret relationships​

Removing one reference makes an object collectible only if no other retaining path remains. Static fields retain values while their class/classloader is reachable, not forever. Tracing GC can collect unreachable cycles.

A dominator tree summarizes unavoidable ownership, not every actual reference. Use Why alive / Inspect to investigate. Protect immutable captures and compare equivalent workloads/GC conditions. See safe capture.