EclipseMAT

756 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
756
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

EclipseMAT

  1. 1. Ali Bahu11/26/2012ECLIPSE MEMORY ANALYZER(MAT)
  2. 2. INTRODUCTION The Java Garbage Collector releases Java objects from memory aslong as no other object refers to that object. A Java heap dump is animage of the complete Java object graph at a certain point in time. Itincludes all objects, Fields, Primitive types and object references. It ispossible to instruct the JVM to automatically create a heap dump incase of a OutOfMemoryError. The Eclipse MAT helps to visualize (based on Java heap dumps) thereferences to objects and provides tools to identify potential memoryleaks. It also helps with reduction in memory consumption. .
  3. 3. INTRODUCTION Eclipse MAT quickly analyzes: Productive heap dumps with hundreds of millions of objects Quickly calculates the retained sizes of objects, Checks who is preventing the Garbage Collector from collectingobjects Runs a report to automatically extract leak suspects. To tell the JVM to create a heapdump in case of anOutOfMemoryError use the option:-XX:+HeapDumpOnOutOfMemoryError
  4. 4. INSTALLATION Install Eclipse MAT via the Eclipse Update manager. Select "General Purpose Tools " and install: "Memory Analyser (Incubation)" "Memory Analyser (Charts)"
  5. 5. HOW TO USE ECLIPSE-MAT Create the Java project “com.fedex.test.first" and the package " com.fedex.test.first “and Create the following class:Package com.fedex.test.first;import java.util.ArrayList;import java.util.List;public class Main{public static void main(String[] args){List<String> list = new ArrayList<String>(); while (1<2){list.add("OutOfMemoryError test");} } }
  6. 6. RUN PROJECT In Eclipse add the -XX:+HeapDumpOnOutOfMemoryError tothe runtime configuration and run the project.
  7. 7. USING ECLIPSE-MAT You should get a new file in your project (.hprof). You may need to refresh your project (F5 on the project) if you areunable to see the file. Double-click it and select"Leak Suspects Report".
  8. 8. ANALYSIS Switch back to the overview and start your investigation of the heapdump. The user interface is quite intuitive. Especially the dominatortree gives a quick overview of the objects being used. You can also create a HeapDump via the jconsole. You can try that bytyping jconsole in the command line to start it.

×