• Save
Upcoming SlideShare
Loading in...5

Like this? Share it with your network

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads


Total Views
On Slideshare
From Embeds
Number of Embeds



Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide


  • 1. Ali Bahu11/26/2012ECLIPSE MEMORY ANALYZER(MAT)
  • 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. 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. INSTALLATION Install Eclipse MAT via the Eclipse Update manager. Select "General Purpose Tools " and install: "Memory Analyser (Incubation)" "Memory Analyser (Charts)"
  • 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. RUN PROJECT In Eclipse add the -XX:+HeapDumpOnOutOfMemoryError tothe runtime configuration and run the project.
  • 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. 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.