Friday, October 26, 2012

Memory Analysis - Gathering Java Cores on Windows WebSphere Servers

After dealing with a few memory leak issues in a windows-based, production environment, I have found the following steps to be most useful for gathering java cores to analyze for potential memory leaks.  

Download the Microsoft Debug Diagnostic Tool v1.2 http://www.microsoft.com/download/en/details.aspx?id=26798

Download the tool appropriate to your environment (32b vs. 64b)
Install the tool with default settings.
Launch the tool.
Cancel the "Rules Wizard" (if it shows up)
Click the "Processes" tab.
Select the java.exe process to be monitored.
Right click and select "Monitor for Leaks".
Wait about 15 minutes after starting the server, then right click the monitored java.exe and select "Create Full Userdump

1.                Install and take the defaults
2.                Launch Debug Diagnostic Tool
3.                Cancel the "Rules" wizard if it pops up
4.                Go to processes tab
5.                Locate the java.exe that you suspect to be leaking memory
6.                Right click and select "monitor for leaks"
7.                After 15 minutes, right click on the same java.exe from step 5 and select "Create Full Userdump"
8.                Depending how log it takes for memory to grow (minutes, hours, days, weeks...) collect 2 more userdumps over time for comparison analysis
9.                Review dumps by clicking the Advanced Analysis tab
10.              Click the "Add Data Files" button
11.              Locate dumps (default: <Debug_Diag_Install_Dir>\Logs\Misc)
12.              Select  the dumps from the same PID that you created in step 7
13.              Select "MemoryAnalysis.asp"
14.              Click "Start Analysis"