IBM Support

Generating and Analyzing Heap Dumps

Troubleshooting


Problem

When to Take Heap Dumps

Heap dumps can be very useful when troubleshooting high memory utilization or OutOfMemoryErrors since they show exactly which objects are consuming most of the heap.

Automatic Heap Dumps

Apache Cassandra is configured to trigger a heap dump at the occurrence of an OutOfMemoryError, but unless you have set your CASSANDRA_HEAPDUMP_DIR in cassandra-env.sh, the file will be written in the Apache Cassandra process's working directory, or may not be written at all due to permission and/or space issues.

You can use the following where Apache Cassandra is running to check the path:

ps -ef | grep HeapDumpPath

Manual Heap Dumps

If you're investigating high heap usage or need to see what's on the heap at a point in time, then you can collect a heap dump using the following methods.

Live Objects Only

Collecting only live objects will result in a smaller heap dump. Use this option if you’re only interested in what is currently referenced. E.g., if you’re not looking for what is taking up heap space, but more so what is actively on the heap.
jmap -dump:live,format=b,file=/path/to/heapdump.hprof <pid>

jcmd <pid> GC.heap_dump /path/to/heapdump.hprof

nodetool sjk mx -mc -b "com.sun.management:type=HotSpotDiagnostic" -op dumpHeap -a "/path/to/heapdump.hprof" true

All Objects

Use this option if unreferenced objects are of interest. For example, if you want to see everything occupying the heap due to high heap utilization.
jmap -dump:format=b,file=/path/to/heapdump.hprof <pid>

jcmd <pid> GC.heap_dump /path/to/heapdump.hprof -all

nodetool sjk mx -mc -b "com.sun.management:type=HotSpotDiagnostic" -op dumpHeap -a "/path/to/heapdump.hprof" false

Analyzing Heap Dumps

The recommended tool for analyzing heap dumps is Eclipse Memory Analyzer, available here: http://www.eclipse.org/mat/downloads.php. It is available as a stand-alone application or as a plugin for Eclipse. Analyzing a large heap dump will require a lot of memory, and you will probably also need to increase the Xmx in MemoryAnalyzer.ini. For a large heap dump, the initial analysis phase can take a long time. After it finishes analyzing the heap dump, you can view the dominator tree to see which objects retain the most heap.

If you need help troubleshooting a memory-related issue, please open a support case.

Document Location

Worldwide

[{"Type":"MASTER","Line of Business":{"code":"LOB76","label":"Data Platform"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SSCR56","label":"IBM DataStax Enterprise"},"ARM Category":[{"code":"","label":""}],"ARM Case Number":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Version(s)"}]

Historical Number

ka0Ui0000000OK5IAM

Document Information

Modified date:
30 January 2026

UID

ibm17258590