Posts

Showing posts from May 26, 2014

How to take JVM Heap Dump using jmap

We have different options for taking a heap dump of running JAVA process and then analyze those dump for any kind for memory leak. Today, We are going to do the same using " jmap " in-built utility provided with JDK. Using this you will get an advantage that you don't need to wait untill our JVM got crashed by using passing " -XX:+HeapDumpOnOutOfMemoryError " parameter to JVM process. We can capture current status using jmap as below: 1.) Find out the jmap location(only if your JAVA_HOME variable not defined)       #locate jmap 2.) After finding jmap location, move to that directory and run jmap to get live thread dump.       #./jmap -dump:live,format=b,file=[file location] [pid] For more details and options run the command with help option as below : # ./jmap -help Usage:     jmap [option] <pid>         (to connect to running process)     jmap [option] ...