How to find JVM heap dump and memory ?


Issue : How to get JVM heap dump ? How to view live java instances(objects) ?

Solution :

Step 1: Run the java application. Get the PID(Process ID) of the application say for example 732

Step 2: From command prompt: jmap -dump:live,format=b,file=c:\heap_dump.bin 732

Heap dump is created in the mentioned location

Step 3: Compile the dump file to view it in user friendly format. From command prompt:

jhat -J-Xmx326m c:\java_app-heap.bin

Step 4: http://localhost:7000 in IE to view live instances and memory used.




No comments:

Post a Comment