Sunday, September 26, 2010

Example

3.1. Create Project

Create the Java project "sawan.modi.mat.first" and the package "sawan.modi.mat.first". Create the following class.

   
package sawan.modi.mat.first;

import java.util.ArrayList;
import java.util.List;

public class Main {

/**
* @param args
*/
public static void main(String[] args) {
List list = new ArrayList();
while (1<2){>

3.2. Run Project

In Eclipse add the -XX:+HeapDumpOnOutOfMemoryError to the runtime configuration.

Run the project.

3.3. Use MAT

You should get a new file in your project (.hprof). You may need to refresh your project (F5 on the project). Double-click it and select "Leak Suspects Report".

Switch back to the overview and start your analyses of the heap dump. I believe the user interface is quite intuitive. Expecially the dominator tree gives quickly an overview of the used objects.

No comments:

Post a Comment

How to Free Up Storage Space on Your Android Phone (Without Deleting Photos)

Running out of space on your Android phone is one of the most common (and most annoying) problems out there - especially once you start gett...