Getting a Heap Dump
Getting a Heap Dump
JVM heap dumps are used to diagnose memory and performance problems.
Automatic Heap Dumps
To set your server to generate heap dumps automatically when a heap out of memory error occurs:
- Open your server's startup script with a text editor.
- Modify JAVA_OPTS to include the following:
-XX:+HeapDumpOnOutOfMemoryError
- Restart your server.
On Demand Heap Dumps
Elastic Path recommends using JMap for generating heap dumps on demand.
Note:
JMap will essentially stop your JVM throughput until it is complete; and it may take 10+ minutes.
- Make sure your server is running.
- With the command prompt, get your server's Java PID using the following command:
jps -l
- Run the following command to generate a heap.bin file in your current directory.
jmap -heap:format=b <java_pid>
Note:
Analyzing the Heap Dump
Elastic Path recommends you use either the Eclipse "Memory Analyzer Tool" plugin or IBM's HeapAnalyzer for analyzing heap.bin.