Thursday, April 28, 2011

Heapdump

1. Automatically take heapdump on OOM (out-of-memory) error
Set following JVM options: -XX:+HeapDumpOnOutOfMemoryError XX:HeapDumpPath=<FILE-PATH>

2. Manually take heapdump
<JAVA_HOME>/bin/jmap -dump:live,format=b,file=heapdump.hprof <pid-of-java-process>

Download and use MAT (Memory analyzer Tool) to analyze the heapdump.

No comments:

Post a Comment