Memory Analysis Tool MAT

Introduction: 
A memory analysis tool provided by Eclipse. It is a feature-rich JAVA heap dump file analysis tool that can help you find memory leaks and reduce memory consumption.
Official website address: http://www.eclipse.org/mat  

installation  (if you are using MOTODEV Studio for Android, the tool comes with it by default)
You can choose to install the original plug-in provided by Eclipse or use the MOTODEV Studio for Android plug-in

> >1. Original plugin 
1). Start Eclipse, click Help -> Intall New Software...
; 3 )
. Wait for the list to be updated, find and expand "General Purpose Tools";
4). Select and download "Memory Analyser (Incubation)" and "Memory Analyser (Charts)".

>>2.MOTODEV Studio for Android plugin 
1). Start Eclipse, click Help -> Intall New Software...;
2). Create a new update through Add (the latest address can be obtained here  ):
    Name:MOTODEV Studio for Android Plugin
    Location: https://studio-android.motodevupdate.com/android/2.0
3). Download and install this update.
*  If it is mainly for Android development, it is recommended to use the integrated plug-in of MOTODEV Studio for Android, which should also provide a lot of convenient tools, but if you have already installed ADT, you need to uninstall it manually before installing it. For details, please refer to: Install MOTODEV as a plug-in Studio.

Use method 1 - run with parameters, 
please refer to: Eclipse Memory Analyser (MAT) - Tutorial
General steps:
(1)  Arguments in Run Conigurations.. set VM argument to:
-XX:+HeapDumpOnOutOfMemoryError
(2)  Run Your project and generate a .hprof file. If you don't see it, please press F5 to refresh the project directory, which is in the root directory;
(3)  Double-click the .hprof file to open it, and select "Leak Suspects Report"

using method 2 - Combined with Sequoyah to monitor specific The device and application
<This method requires you to install the Sequoyah  or MOTODEV Studio for Android plug-in> For

details, please refer to: Using MAT to analyze application memory

-------------------------------------------------- ------
*Note: 
Parsing a HeapDump that is too large may cause Eclipse to throw an OutOfMemory error:

 
At this time, you need to manually adjust the size of Eclipse's cache, you can refer to the handling method given by the official website ( original link  ):

 
>> My usage: 
My machine can only be set to 512m, and I still can't solve the problem of OutOfMemory. It seems that there are certain requirements for memory...

But I downloaded the RPC version of MAT and it can be opened normally. Eclipse Friends who cannot open the plug-in version can try this method: RPC version MAT download address  .
-------------------------------------------------- ------

The interface after opening is as follows: 


更详细的使用示例请参考以下文章: 
http://wiki.eclipse.org/index.php/MemoryAnalyzer
—— 官方的帮助文档

使用 Eclipse Memory Analyzer 进行堆转储文件分析
—— 来自IBM的使用教程

Eclipse Memory Analyser (MAT) - Tutorial
—— 一个浅显易懂的MAT使用教程

使用Memory Analyzer tool(MAT)分析内存泄漏(一)
使用Memory Analyzer tool(MAT)分析内存泄漏(二)
—— 详细地分析了内存泄露的原因,并举例说明,强烈推荐

Guess you like

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