Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
MAT
When using MAT analysis object has two important concepts
outgoing references, the object references which objects
incoming references, which objects referenced object
Diagram
Code
public class A {
private C c1 = C.getInstance();
}
public class B {
private C c2 = C.getInstance();
}
publicclass C {
private static C myC = newC();
public static C getInstance() {
returnmyC;
}
private D d1 = new D();
private E e1 = new E();
}
public class D {
}
public class E {
}
public class SimpleExample {
public static void main (String argsp[]) throws Exception {
A a = new A();
B b = new B();
}
}
FIG Example
Run
jmap -dump:live,format=b,file=3144.bin 3144
Analysis of
the histogram where the input fully qualified class name
selection to give incoming
selected outgoing