Free tutorials for Java, Eclipse and Web programming



Follow me on twitter

Eclipse Memory Analyser (MAT) - Tutorial

Lars Vogel

Version 0.3

05.10.2009

Revision History
Revision 0.101.10.2009Lars Vogel
Created
Revision 0.202.10.2009Lars Vogel
Example project
Revision 0.305.10.2009Lars Vogel
sub-chapters for example

Eclipse Memory Analyser (MAT)

This article describes the usage of the Eclipse Memory Analyser (MAT) to identify memory leaks.

This article is based on Eclipse 3.5.


Table of Contents

1. Eclipse Memory Analyser (MAT)
2. Installation
3. Example
3.1. Create Project
3.2. Run Project
3.3. Use MAT
4. jconsole
5. Thank you
6. Questions and Discussion
7. Links and Literature
7.1. Source Code
7.2. vogella Resources

1. Eclipse Memory Analyser (MAT)

The Java Garbage Collector releases Java objects from memory as long as no other object refers to this object.

A Java heap dump is an image of the complete Java object graph at a certain point in time. It includes all objects, Fields, Primitive types and object references.

It is possible to instruct the JVM to create automatically a heap dump in case of a OutOfMemoryError.

The Eclipse MAT helps to visualize based on Java heap dumps the references to objects and provides tools to identify potential memory leaks.

To tell the JVM to create a heapdump in case of an OutOfMemoryError use the option -XX:+HeapDumpOnOutOfMemoryError