OnCallReady

Commands

jmap - print details of a specified process

jmap -histo[:live] pid
jmap -dump:[live,]format=b,file=<file> pid

Options you will use

-histo[:live[,file=<f>]]
Class histogram. :live forces a full GC first and counts only reachable objects.
-dump:live,format=b,file=<f>
Heap dump in HPROF format. The path is resolved on the client side.
-clstats
Class loader statistics.
-histo:live
Class histogram of the LIVE objects only: forces a full GC first, then counts what is still reachable.
-heap
REMOVED in JDK 9+: "Invalid option". Use jhsdb jmap --heap --pid PID or jcmd PID GC.heap_info.

Examples

$ jmap -histo:live 1210 | head -15

Top classes by bytes.

$ jmap -dump:live,format=b,file=/tmp/orders.hprof 1210

Dump for Eclipse MAT.

Gotchas

Taught in

Try jmap in a real terminal Free, in your browser - a real Ubuntu terminal to try it in, with missions that check your work.