How to use Memory Analyzer with eclipse

Follow below steps to use MAT in eclipse

1. create sample project with simple program. If you observe the program that have three threads with sleep to get process slow because to monitor MAT we required process ID.
If program is small will not get process ID, because process of program will not take much time so will not get process ID.

mat sample program


2. Execute the program, Next our job to monitor the process Id for program in MAT. 3. Open Perspective->Others->Select Memory Analyzer.

mat perspective


4. Go to Acquire Heap Dump in file

Open MAT

5. Options->Leak Suspect Report

MAT-Heap

6. See the Description as a class name, because present program is running. Select the row, will create file extension with .hprof, file name along with processed.

Mat list of PID

7. Select the Home directory for Java.

JDK in MAT


8. Select the histogram option

MAT histogram


9. Next step Select Group Results by, In that Select Group by Package

mat filter

mat group filter


10. See the results of the page. Observe Shallow Heap and Retain Heap for our program

mat help content

Mat help window