Thursday, August 25, 2011

Generating heap dump on live WAS JVM script

Hi All!

There has been quite a while since my last post. This will be short one.
Recently we had to diagnose some memory leak on WebSphere Portal. We allready had post-mortem heap dumps. To better understand what is going on we needed ones from live server to.
There is an easy way to generate heap dump on live WebSphere JVM using scripting. John Pape blogged on this subject recently. In nutshell one needs to connect to server using wsadmin and execute MBean generateHeapDump method.

This task is very easy using following script: Save script above as generateHeapDump.py in your was_profile_root/bin directory and execute following command:
wsadmin.bat -f generateHeapDump.py -lang jython
This should result with new heap dump in was_profile_root directory.
To analyze it download IBM Support Assistant and use IBM Monitoring and Diagnostic Tools for Java™ - Memory Analyzer tool.
Alternative is to directly download MAT from eclipse. Hope this helps to stop those leaks!