May 18

Eclipse Memory Manager Plugin

Posted by James Netherton | Sunday 18 May 2008 12:09 PM | In Java

I thought I'd mention this as it ties in quite nicely with my previous post.

Currently in incubation phase, Eclipse has a memory manager plugin which can analyse and provide some nice graphs and statistics from Java heap dumps.

The plugin can be downloaded here. There is an additional dependency on the BIRT charting and reporting plugin. Instructions for installing this are here.

Once everything is installed you can begin heap analysis. Use the jmap utility to create a heap dump file from a running JVM instance. You'll need the JVM process ID in order to do this.

Open up a command prompt or terminal session and execute the command below. Be warned that the size of the file produced can be quite large (over 100Mb).

jmap -dump:format=b,file=heapdump.hprof <process id>

From eclipse you can use the memory manager to open up and analyse the dump file.

Java 1.6 includes a simpler heap analysis tool named jhat. To analyse the heap dump we obtained from jmap, execute the following command:

jhat heapdump.hprof

Now point your web browser at http://localhost:7000 to see view the heap analysis results.

All of this may be useful if you're experiencing the Java OutofMemory exception. You can set the JVM parameter -XX:+HeapDumpOnOutOfMemoryError to dump the heap on out of memory exceptions.

 

0 Comments

[Post comment]


Leave a comment








Captcha text