This post originated from an RSS feed registered with Java Buzz
by Marc Logemann.
Original Post: analyzing IBM JDK heapdumps
Feed Title: Logemann Blog
Feed URL: http://www.logemann.org/blojsom/blog/default/?flavor=rss2
Feed Description: Marc's thoughts on Java and more
As i have written here, there are no profiling tools available for IBM Power Platform. Not on I5/OS, not on LinuxPPC nor on AIX. This leaves with two options during java development:
1. Don't make any faults regarding memory management
2. use tools IBM offers on alphaworks
Option 1 is not a viable one for me because i do make errors and some of them are definitely memory related. In the noted blog entry, i already covered a tool for analyzing GC, now i want to continue with HeapAnalyzer, another tool which is invaluable for Java issues on IBM hardware.
So the big question is, how do you get a dump file. You can control it via JVM properties or by just waiting until you get an OutOfMemory error, this will produce the dump automaticly by default. If you want to know more about all the profiling related JVM options for IBM JREs, you should consult this site. There are links to various tools and a PDF which explains everything in the area of debugging problems. Use this quick-link for the PDF.
After starting HeapAnalyzer you should open the dump, after that you will get the following window in the tool.
As you can see, its a 540MB heap dump.
Now you do a lot of things, but the most useful things to do is to do "Tree View". Just a little screenshot how the TreeView looks like:
When right clicking on the root node you should click "compile Leak suspects". This will result in something like this:
When clicking on one of the suspects, you are in the correct place in the tree view. Normally you will see enough to have an idea where your memory gets eaten. In my case its an incredible large array of AccountingHistory objects which come directly from a database. I simply forgot that each History entry is about 500kb big and i loaded a lot of them for displaying in a pageable HTML list. Unfortunately there was a non displayed (but nevertheless existant) CLOB aka String that was my problem. Furthermore i detached the persistence aware object, which doubles the amount of memory. But thats a different story.
So the next time something is slow or die because of OutOfMemory on an IBM Power platform, use what IBM supplies. But at the end i prefer to work with tools like JProfiler for those problems, but as i said, all the major tools dont have agents for IBM PowerPC architectures.