Introduction to the MAT (Memory Analyzer Tool) tool

1. What is MAT?
    MAT (Memory Analyzer Tool), an Eclipse-based memory analysis tool, is a fast, feature-rich JAVA heap analysis tool that can help us find memory leaks and reduce memory consumption. Use the memory analysis tool to analyze from a large number of objects, quickly calculate the size of the objects in the memory, see who is blocking the garbage collector's recycling work, and visually check the possible results through the report Object.
   
2. Why use MAT?
    When the server application occupies too much memory, it will encounter OutOfMemoryError. How to quickly locate the problem? The advent of Eclipse MAT makes this very easy. It can analyze dumped file data offline.
    Eclipse MAT is a tool contributed by SAP, which can be downloaded from the Eclipse website for free. It is much stronger than the memory mirror analysis tool jhat provided by Sun.
3.
Home page: http://www.eclipse.org/mat/
plugin update address:
http://download.eclipse.org/mat/1.0/update-site/
First call the jdk tool to get the heap usage
I installed is jdk1.6
C:/>java -version
java version "1.6.0_11"
Java(TM) SE Runtime Environment (build 1.6.0_11-b03)
Java HotSpot(TM) Client VM (build 11.0-b16, mixed mode, sharing)
call jdk tool jps to view the current java process
C:/>jps
3504 Jps
3676 Bootstrap
3496 org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
Call the jmap tool to get the information
C:/>jmap -dump:format=b,file=heap.bin 3676
Dumping heap to C:/heap.bin ...
Heap dump file created
At this time, our C drive root directory, just The heap.bin file is generated, and the file is opened with eclipse's file---->open. The first is a startup diagram:

Here you can choose to view
1. Memory leak report, automatically check the objects that may have memory leaks, and display the survival through the report Objects and why they are not garbage collected;
2. Object report, analysis of available objects, such as whether the definition of strings is heavy, empty collections, finalizers, and weak references.
What I choose here is to view the memory report. The following is a sketch of the screenshot:


It is very clear through the report display. There are detailed instructions below. There is no post map here. If you are interested, you can continue to explore.

Reprinted: http://blog.csdn.net/fenglibing/article/details/6298326

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326830247&siteId=291194637