How to generate JVM Heap dump

  • Find the process Id of the java process

In linux. Go to command line.

ps aux | grep ‘java’

 

  • To generate the dump.

 

jmap -dump:format=b,file=/tmp/heapdump-001.hprof <process id>

 

$ jmap -dump:format=b,file=/tmp/heapdump-001.hprof  31467

Dumping heap to /tmp/heapdump-001.hprof …

Heap dump file created

 The dump file wil be generated at /tmp/heapdump-001.hprof.

 

$ ls -al /tmp/heapdump-001.hprof

-rw——- 1 admin admin 48657063 Feb 23 10:00 /tmp/heapdump-001.hprof

 

 You can use Eclipse Memory Analyzer  to analyze the heap dumps

http://www.eclipse.org/mat/

Leave a Reply

Your email address will not be published. Required fields are marked *