Most Read This Week
Using Eclipse Memory Analyzers
Identify leak suspects
By: Pavan Gorakavi
Dec. 25, 2009 02:45 PM
The garbage collector is primarily responsible as a collector to reclaim objects that are no longer used by the application. This is an automatic memory management invented by McCarthy. The garbage collector collects unreferenced objects, objects that are not reached by the reference chain. The starting point of the analysis is the Garbage Collection Root (GCR), which are objects that are reachable by the VM. Objects that are nonreachable are garbage collected, whereas objects that are reachable are sustained in memory. GCR is very useful in identifying memory leaks and the reference chain from an arbitrary object to GCR tells about the suspects.
The Eclipse Memory Analyzer is a fast, feature-rich Java heap analyzer that helps to identify memory leakage. This project was initially released in December 2008 and is now part of the Galileo release train. The Eclipse Memory Analyzer (MAT) provides a large selection of features to help in analyzing a single snapshot of heap. MAT can be used to identify memory leaks using a single click.
Heap Dump - Shallow Heap, Retained Heap
Leak Suspect Report with a Single Click
An on-demand heap dump can be obtained using the following JVM parameter:
We can also get the heap dump using jmap, jconsole, and hprof.
Importing an hprof file
Once a file is opened, MAT process the hprof file. Check your heap restraints while processing huge hprof files. You can extend the heap configurations at MemoryAnalyzer.ini. Once parsing completes, we need to select a leak suspect report to check heap dump for leak suspects. It provides details about the different objects and why they have not been garbage collected.
We get a higher level of leak suspect report with a pie chart and list of leak suspects.
To get the top consumer at that particular instance, we need to click on Top Consumer in the Leak Identification Category.
The denominator tree lists the biggest objects. It's also called as a keep-alive tree as the next level shows those objects that are immediately prevented from garbage collections.
By drilling down, we can check incoming - outgoing references, GCR. The dominator tree can also be grouped by class loaders. The histogram view lists the objects grouped by class.
This view helps to identify the starting point for our analysis. Asample histogram view is illustrated below.
Reader Feedback: Page 1 of 1
Subscribe to the World's Most Powerful Newsletters
Today's Top Reads