Sunday, February 05, 2012

MAT(Eclipse Memory Analyzer Tool) Usage Simple Check list

Those are some basic steps to do heap dump analysis using MAT when there comes an OOM or memory leak issue:

Pre-condition:Config MAT correctly(you may edit JVM Heap size if it is not sufficient to open a .hprof file, for example, modify "-vmargs-Xmx1280m" to MemoryAnalyzer.ini)
1. Quick Overview on Leak Suspects Report: it will give you some indicator to the leak suspects or the memory issue, it shows the biggest retained heap size after grouping by the same instance name
2. Quick Overview on Overview Pane: it lists the each biggest individual object by retained heap size
3. Open histogram to list number of instances per class, within the histogram, you can check:

  • Order by Shallow heap size to see if there is a particular object taking too much memory size, then drill it down by showing its dominator tree view for further analysis
  • Order by Retained heap size which represents the amount of memory that will be freed by the garbage collector when this object is collected, then drill it down by showing its dominator tree view for further analysis
  • Order by Objects Count to see if a lot of objects are accumulated, and take the further analysis by viewing the "merge shortest paths to GC roots" (Who is referencing them)
4.Some specific class needs to be paid attention to, for example "org.apache.catalina.core.ApplicationHttpRequest", it includes the very useful attributes for trouble shooting and reproducing the problems which are RequestURI and queryString

--Cheng Chi

No comments:

Post a Comment