MAT outgoing references / incoming references

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.
This link: https://blog.csdn.net/qq_22222499/article/details/100069126

Article Directory

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
Here Insert Picture Description
Run

jmap -dump:live,format=b,file=3144.bin 3144

Analysis of
the histogram where the input fully qualified class name
Here Insert Picture Description
selection to give incoming
Here Insert Picture Description
selected outgoing
Here Insert Picture Description

Guess you like

Origin blog.csdn.net/qq_22222499/article/details/100069126