Memory Analyser, Eclipse Galileo Feature #5

With all the great work going on in the Eclipse Run-time space, like the EMF Runtime, RAP, Birt Charting Engine, ECF, Jetty and of course Equinox, I sometimes forget that Eclipse started as an excellent platform for tools. The Eclipse Memory Analyzer project reminded me just how good Eclipse tools are.

All week I have been counting down the top 10 Galileo features that I’m most excited about. Number 5 on my list is the Eclipse Memory Analyzer (MAT). This project was first released in December 2008 and is now part of the Galileo release train. MAT provides a large selection of features to help you analyze Java heap dumps to understand your memory consumption and help remove leaks.

As you may have noticed, many of my posts focus on the simplicity of the new features. The MAT project is no different. Getting started with the Memory Analyzer is a simple 3 step process:

  1. Install the MAT tools (optionally install the charting engine too). (Hint: Use p2 for this)
  2. Grab a heap dump:I simply used the JMap tool available with my JDK. 12345 was the PID of my Eclipse process.
    $ jmap -heap:format=b 12345
  3. Open the Heap Dump
    JMap generates a file called heap.bin

Some of the notable features include:

  • The reporting of memory leak suspects:leak suspects Memory Analyser, Eclipse Galileo Feature #5
  • Calculating Retained Sizes (How much memory is used, rooted at a particular object):retainedHeap Memory Analyser, Eclipse Galileo Feature #5
  • Track the pointers back to the GC (garbage collection) roots:path to gc Memory Analyser, Eclipse Galileo Feature #5
  • Thread and Stack information:threads Memory Analyser, Eclipse Galileo Feature #5
  • SQL-like language for querying the heap:query Memory Analyser, Eclipse Galileo Feature #5

    Shout-outs for this go to Andreas Buchen and the entire Memory Analyzer team. Thank-you for guys for such an awesome (and unbelievably useful) tool!

    Note: I got these examples by running the memory analyzer on Eclipse, after analyzing a 670 Meg heap. It’s unbelievable, but the MAT heap was only 21 Megs. 21 Megs used to analyze over 1/2 a Gig. How cool is that?

  • 4 Responses to “Memory Analyser, Eclipse Galileo Feature #5”

    1. I had a pleasure to work with MAT when we had memory problems with our server in my day job. It is a fantastic tool! It builds own indexes about objects in the heap, and is very fast doing various queries. As you point out, doesn’t consume lot of memory. Its leak suspects quickly revealed where the problem is (in our case, jdbc driver was the culprit), and using thread view we quickly found out what happened. I am looking forward to using it again … although I hope that I will not need to :-)

    2. Wim Jongman says:

      Ian,

      Thanks man for this great series. I wish you would have started at 20.

    3. Arat says:

      Can anybody help me how to add the Memory Analyzer tool in eclipse 3.4.2!

    4. vittal says:

      MAT is really good Tool to get clear picture of memory leak.
      However I found in most of the result for top level dominator class loader it gives the result as

      Label Number of Objects Used Heap Size Retained Heap Size Retained Heap, %
      org.jboss.classloader.spi.base.BaseClassLoader 251,672 19,412,768 2,489,129,584 86.62%

      It will be of great help if somebody would guide me to analyze the root cause for this.

      Thanks in Advance.
      Vittal

    4 responses so far

    Written by . Published in Categories: EclipseSource News, Planet Eclipse