1, monitoring purposes
2. Common analysis Tools
3, Analysis case-mat
MAT Introduction and Analysis:
Start the mat and select the menu item File-open heap dump to load the heap dump file that needs to be parsed. After the file is loaded, you can see the interface shown in 1:
From Figure 1, you can see most of his features:
? Histogram can list objects in memory, number and size of objects
? Dominator Tree can list which threads and which objects the thread is executing occupy space
? Top consumers lists the largest object by graph
? Leak Suspects automatically analyzes the cause of leaks through MA.
Histogram 2:
Objects: Number of objects in a class
Shallow size: The size of the object itself occupies memory and does not contain references to other objects, that is, object headers plus member variables (not values of member variables) and sums. :
Retained size: Is the sum of the shallow size of the object's own shallow size+ accessed directly or indirectly from the object to the object. In other words, the retained size is the sum of the memory that the object can be recycled to after it has been GC.
As you can see from Figure 2, the objects of the Java.util.HashMap class occupy a lot of space.
Dominator Tree 3:
As you can see from Figure 3, Com.csii.ibs.lc.ClusterOnlineUserRegistry takes up a lot of memory space
Top comsumers 4:
Shows what the largest objects in memory are, what their corresponding classes are, and what class loaders are classloader. There are times where we can see where the code leaks.
4. A case:
Today's online business JVM monitors for memory leaks
Select Path to GC Roots->exclude weak references, filter
Then it's very intuitive to analyze what's causing it and then optimize it.
Analyzer Tool (MAT) analyzes JVM memory leak cases