Quote

"Between stimulus and response there is a space. In that space is our power to choose our response.
In our response lies our growth and freedom"


“The only way to discover the limits of the possible is to go beyond them into the impossible.”


Monday, 3 March 2014

Generating Heap Dump and Finding Memory Leaks Using MAT



Eclipse Memory Analyzer standalone tool is preferred for generating on demand heap dump. It can be downloaded from the following location: http://www.eclipse.org/mat/downloads.php
After downloading the zip (currently: MemoryAnalyzer-1.3.1.20140107-win32.win32.x86) extract it and open MemoryAnalyzer.exe to open the MAT UI 

MAT UI

Now click File --> Acquire Heap Dump to open Acquire Heap Dump Dialog
Select the process ID of application and click next


Provide an argument if required or Click finish

Heap Dump will be generated and getting started wizard will open automatically



By default the ‘Leak Suspect Report’ radio button is selected so click on the ‘Finish’ button to start generating the default report.

Leak suspect report will be generated as follows:



Now you can look at the leak suspects try to find the potential/actual leaks.
To find leaks you can also look at the top consumers from the heap dump using MAT from the following location


The top consumers report is generated as follows

These reports can be a good starting point for finding memory leaks and application performance issues. Though performance engineering is far too deep and is like an art where with experience you can get more of the numbers generated by the tools. 


14 comments: