JVM tool guide · jvm clijmap: Inspect the JVM Heap and Dump It for Analysis
jmap (Java Memory Map) is the bundled tool for inspecting a running JVM's heap: it prints heap summaries, histograms of object counts by class, the process memory map, and — most importantly — can capture a full heap dump to a file for offline analysis.
Since JDK 9, the recommended way to dump a heap is jcmd GC.heap_dump, but jmap remains widely deployed and its -histo output is a fast way to see 'which classes dominate this heap' without opening a GUI.
Official jmap project
Histogram of objects in the heap
-histo counts instances and total size per class. The output is sorted by instance count or total size depending on the flag; -histo:live restricts to reachable objects.
# Count and size of each class on the heap
jmap -histo:live <pid>
# Limit to the top 30 by total size
jmap -histo:live <pid> | sort -k3 -n -r | head -30
Heap summary
-heap prints a compact summary of the heap configuration and usage, plus a per-generation breakdown. Great first signal for 'is this thing out of heap'.
jmap -heap <pid>
Capture a heap dump
-dump writes a .hprof file you can open in Eclipse MAT. -dump:live only serializes reachable objects, making the dump smaller and usually the right choice.
# Dump live heap to file
jmap -dump:live,file=/tmp/heap.hprof <pid>
# Dump everything
jmap -dump:file=/tmp/heap-full.hprof <pid>
Process memory map
-clstats and -finalizerinfo give class-loader statistics and pending finalizers; for the raw address map use the OS tools (pmap on Linux).
# Class-loader statistics
jmap -clstats <pid>
# Pending finalizer info
jmap -finalizerinfo <pid>
Quick startGet productive in minutes
Fastest look + a dump
In under a minute you get a histogram and a dump you can hand to MAT.
jmap -histo:live <pid> | head -30
jmap -dump:live,file=/tmp/heap.hprof <pid>
Last updated August 2026 · JVM Tools is independent and not affiliated with Oracle.