Diagnose out-of-memory errors and Java heap memory leaks

 

+

Search Tips   |   Advanced Search

 

Memory Dump Diagnostic for Java is an offline tool for diagnosing root causes behind memory leaks in the Java heap dumps.

The tool analyzes common formats of memory dumps from the JVM in which the WAS runs. The analysis of memory dumps is targeted toward identifying data structures within the Java heap that might be root causes of memory leaks. The analysis also identifies a summarized set of object groups that contribute significantly to the Java heap footprint of the application. The tool is capable of analyzing very large memory dumps from production-environment appservers that exhibit out-of-memory issues.

This tool works with the memory dumps that are generated from WAS, not from the Memory Dump Diagnostic for Java tool. The following dump formats are supported:

IBM Portable Heap Dump (*.phd) WAS v5.1.x and later on AIX, Linux, and Windows
IBM Text WAS v4.x and 5.0.x on AIX, Linux, and Windows
HPROF WAS installations on HP-UX and Solaris

 

Overview

Memory leaks can occur in Java applications when object references are unintentionally held onto after the references are no longer needed. This problem prevents the Java garbage collection process from freeing memory, even though the Java language has a built-in garbage collection mechanism that frees the programmer from explicit object deallocation responsibilities. Memory leaks are hard to diagnose in large complex Java applications, because of the large number of objects in the Java heap and because of the complex relationships between these objects.

Two types of analysis mechanisms are available...

The tool lists suspected data structures and data types and displays contents of the memory dump in an interactive browser-based Web application. The tool shows footprint analysis results in a graphical layout of significant sets of data types that have similar ownership structures. The tool shows the contents of the memory dump in an interactive tree view for browsing and in two table views of objects and data types, respectively. The tree view enables you to look for all incoming and outgoing references for each object and to see the location of a container object within each data structure with a suspected memory leak.

Analyzing memory dumps in an offline fashion provides a low-overhead mechanism for identifying root causes behind memory leaks. This mechanism is particularly suitable for large applications running in production or in stress-test environments, where memory leaks are often detected first.

 

Procedure

  1. Install IBM Support Assistant on a computer that is separate from the appserver installation to be analyzed.

    Use a non-production computer with at least 5 gigabytes (GB) of free disk space, at least 1.5 GB of RAM, and an Intel processor that runs at 2 GHz or faster, preferably on the Linux platform.

  2. Enable verbose garbage collection on the appserver installation to be analyzed.

    Verbose garbage collection information helps to rule out basic configuration issues and memory-leak issues from fragmentation or native memory leaks.

  3. Optional: Enable lightweight memory-leak detection

    Enabling lightweight memory-leak detection can help with early detection of abnormal memory usage behavior and for automatically triggering heap dumps.

  4. Enable the JVM heap dump feature for WAS.

    Refer to the documentation that is supplied with the tool when you start from IBM Support Assistant.

  5. When the heap dump is available, run the Memory Dump Diagnostic for Java tool.

    1. Start IBM Support Assistant.
    2. In IBM Support Assistant, select the Tools tab.
    3. On the left side, click WebSphere 6.1.
    4. On the right side, click Memory Dump Diagnostic for Java.

 

Results

The possible root causes of memory leaks are identified. Memory leaks in the Java heap produce...

java.lang.OutOfMemoryError

...exceptions in log files. However, not all out-of-memory errors are caused by Java heap memory leaks. Out-of-memory errors can also be caused by the following conditions:

For both of these conditions, the out-of-memory error can occur in spite of large amounts of free Java heap space. Consequently, the Memory Dump Diagnostic for Java tool might not be effective in determining root causes in these cases.


 

Related tasks

Get IBM Support Assistant
Enable automated heap dump generation
Diagnose problems (using diagnosis tools)

 

Related information

IBM developer kits: Diagnosis documentation