1.

How Do You Take The Heap Dump Of A Java Process?

Answer»

There are many ways to take the heap dump of a Java process e.g. Tomcat, but most common is by using tools available in JDK e.g. jVisualVM, jCmd, and jmap. Here is the command you can use to take the heap dump of Java process:

$ jmap -dump:live, file=/location/of/heap_dump.hprof PID

The heap dump will contain all live objects and they are stored in heap_dump.hprof file. Remember, you also need PID of Java process which you can FIND by using "ps" and "grep" command as discussed in the first QUESTION. You can see Java Performance COMPANION by Charlie HUNT to learn more about taking and analyzing heap dump in Java to find memory leak and other memory related ERRORS.

There are many ways to take the heap dump of a Java process e.g. Tomcat, but most common is by using tools available in JDK e.g. jVisualVM, jCmd, and jmap. Here is the command you can use to take the heap dump of Java process:

$ jmap -dump:live, file=/location/of/heap_dump.hprof PID

The heap dump will contain all live objects and they are stored in heap_dump.hprof file. Remember, you also need PID of Java process which you can find by using "ps" and "grep" command as discussed in the first question. You can see Java Performance Companion by Charlie Hunt to learn more about taking and analyzing heap dump in Java to find memory leak and other memory related errors.



Discussion

No Comment Found