Wednesday, April 7, 2010

Java - Heap Dump

Memory is always an issue for software. Whenever it occurs, you will always find it difficult to track them down. If you are using Java6, you can use the following to as help

1. Include JVM options -XX:+HeapDumpOnOutOfMemoryError

This will create a heap dump whenever a OutOfMemoryException occurs. It will output a .hprof file at your root folder

Then, use jhat .hprof to analyze the heap dump. Jhat will analyze the heap dump file and create a server instance for analysis. Use your browser, http://localhost:7000/ to see heap information such as heap histogram.

2. Include JVM options -XX:+PrintGCDetails

This command will print current GC details on application output. Good to know what is the current status of the GC.

3. JConsole

JConsole is an application that can help you monitor your application real time. You can use JConsole to connect local or remote application for application monitor and analyze.

See the following for more details

http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html
http://java.sun.com/developer/technicalArticles/J2SE/monitoring/#Insufficient_Memory

No comments:

Post a Comment

Windows 7 - STOP 0x0000007B (0xFFFFF880009A97E8 0xFFFFFFFFC0000034 0x0000000000 0x0000000000)

If you encounter STOP 0x0000007B (0xFFFFF880009A97E8 0xFFFFFFFFC0000034 0x0000000000 0x0000000000) blue screen of death. This is very like...