programming

Java

Heap dump

Generate a Heap dump

On demand

The jcmd tool produce a binary heap dump

jcmd <pid> GC.heap_dump <file-path>

On crash

The below option does not add overhead, and using it in production is a good idea.

java -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=<file-or-dir-path>

Analyse a thread dump

Eclipse Memory Annalyser allows to analyse the resulting dump files. this tutorial explains well how to use the tool.

This page was last modified: