Thursday, October 11, 2012

Java Thread dump and Heap dump


I found many people in industry assume Java Thread dump and Heap dump as same.

A thread dump is a complete list of Java threads that are presently active in a JVM. This is good for understanding behaviour of a Java application at a given time. Most of the time app developers will request app infra team to get a thread dump for their analysis. (e.g. deadlock).

 

How to take thread dump?

#jstack <pid> >> threaddumps.log

A heap dump is a dump of the Java heap memory. This is useful for analysing what use of memory that Java app is making in JVM, help in diagnosing some memory issues. (e.g. memory leaks)

 

How to take heap dump?

#jmap -dump:format=b pid

 

No comments:

Post a Comment