Samuel Sjöberg's weblog

Skip to navigation

Heap dump analysis

A couple of weeks ago, at work, I had to tackle an OutOfMemoryError in production. I find these kind of errors especially though to fix since it's often hard to pinpoint the problem based solely on information found in the logs.

I could however finally solve it with help of Eclipse Memory Analyser (MAT). MAT is a tool to analyze heap dumps. It presents a graphical overview of the heap and makes it easy to drill down to analyze the data. It can also generate leak reports that can help to pinpoint leaky objects. It is also good to know that MAT had no problems handling really large heap dumps (> 512 mb). The by Sun provided jhat utility ran out of heap space when I tried it. Ironic, I know...

To use MAT, a heap dump is required. To take a heap dump one can use jmap, a utility program, bundled with the Java 6 JDK. The tricky part is not to take a heap dump, it is to get a chance to take it while the application is still running (remember, mine was in production).

Pages linking to this entry

Pingback is enabled on all archived entries. Read more about pingback in the Pingback 1.0 Specification.

About this post

Created 24th November 2008 22:41 CET. Filed under Java.

0 Pingbacks