Friday, August 28, 2009

Cool memory analysing tool for eclipse

Found a pretty cool tool to analyse heap dump files from within eclipse called Memory Analyzer. You can check for memory allocation and find out about your memory leaks, what processes are taking huge heap memory etc. More info can be found in the following links.

http://www.eclipse.org/mat/
http://ice09.wordpress.com/2009/06/28/eclipse-galileo-mat-and-a-little-spring/

The Perm Gen Exception in JBoss

We sometimes get the PermGen runtime exception thrown from JBoss when running our app. Following in the lines of the exception i stumbled upon two very useful articles explaining the same. This can be found at;

http://www.unixville.com/~moazam/stories/2004/05/17/maxpermsizeAndHowItRelatesToTheOverallHeap.html
http://narencoolgeek.blogspot.com/2007/08/heap-size-and-perm-size.html

As it states Permanent Generation space is different from the Heap space we set using th -Xms commands as Perm Gen space is used to store class objects / method objects generated using reflection. As we use Hibernate this space is definitely growing with time and as the first post above says we should set the -XX:PermSize and -XX:MaxPermSize when running our app servers in order to minimize the risk of these exceptions occurring. You can also set the -XX:+HeapDumpOnOutOfMemoryError option to tell the VM to generate a heap dump if OutOfMemoryError is thrown.