What is Eclipse Memory Analyzer?
Diffusion can generate heap dumps which can be imported into an Eclipse plugin called Eclipse Memory Analyzer (MAT). This is useful under some circumstances when an out of memory errors occurs.
Creating a heap dump
By default Diffusion creates a heap dump when it runs out of memory which is achieved by the following line in the startup script:
-XX:+HeapDumpOnOutOfMemoryError When an out of memory error occurs a .hprof file will be generated which contains the heap dump. The location of the generated .hprof file is defined in the startup script and is set to place the file in the Diffusion logs directory by default:
Installing the plugin
In eclipse navigate to Help -> Install New Software and select the appropriate update site for your release of Eclipse. There are two plugins to install but the exact locations of the plugins may vary with your version of Eclipse. The names of the plugins are:
- Memory Analyzer
- Memory Analyzer (Charts) [optional]
In Eclipse MARS these can be found under Performance, Profiling and Tracing Tools.
Reading a heap dump
Opening a .hprof file in Eclipse will load it into the Memory Analyzer plugin. Select “Leak Suspect Report” and click Finish to see an analysis of the heap dump. A pie chart is displayed that that shows the leak suspects and information about each suspect appears underneath. If you click the overview tab at the top you will be presented with details and further actions that you can take.
More information is available in the Memory Analyzer Wiki.