How to take heap dump of a java process

To take heap dump in java we can use jmap.exe avaialble in JAVA_HOME/bin/ directory

jmap.exe -dump:format=b,file=D://filename.hprof 2860

Here 2860 is the Process Id of my java find process id of your application we can use jcmd.exe

jcmd.exe -l 


6132 -l
2860 quartz.QuartzSchedularExample

once the heap dump file is created, use jvisualvm.exe tool present in java bin directory,in jvisualvm GUI select load and browse your dump file.

Note:If you want a heapdump on out-of-memory, you can start Java with the option


the above option will take a heap dump when OutOfMemoryError thrown by JVM


java -jar -XX:-HeapDumpOnOutOfMemoryError myApp.jar
This entry was posted in Java. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s