Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[mat-dev] About the API usage

Hi, folks.
I'm now trying to customizing MAT to analyze the HotSpot heap dump of a specific program. After reading the developer guide on http://wiki.eclipse.org/MemoryAnalyzer/Extending_Memory_Analyzer and doing some tests, I encounter some questions as follows:

1) Is there a clean version of MAT which has nothing to do with eclipse UI?
I just want to use MAT's core classes such as IClass, IObject and etc. Ideally, MAT is a jar, so I can launch an ordinary Java project and just import MAT into the Classpath. For example, If I want to write a program to look for a specific object in the heap dump, I only need to write a main method and use ISnapshot to find it. Currently, I need to launch a plugin project as illustrated in http://wiki.eclipse.org/MemoryAnalyzer/Extending_Memory_Analyzer. 

2) Is it possible to get the name of the object?
For example, suppose a method defines:
-------------------------------------------------
String apple = "APPLE";
String banana = "BANANA";
List<String> fruits = new ArrayList<String>();
fruits.add(apple);
fruits.add(banana);
-------------------------------------------------
From the heap dump, we can get "java.util.ArrayList" and "java.lang.String". However, can we know the names of these variables (i.e., apple, banana, fruits)?

3) Given an object, how to use the api to find its host thread and methods?
For example, 
-------------------------------------------------
public void foo() {
String apple = "APPLE";
}
public static void main(String[] args) {
foo();
}
-------------------------------------------------
Given the object apple, I want to know its host methods (i.e., foo() --> main()) and thread (i.e., main thread). Is it possible?

Thanks in advance!
Lijie



Back to the top