Eclipse Memory Analyzer使用

  Eclipse Memory Analyzer是Eclipse提供的内存分析工具,是一个快速、功能丰富的JAVA heap分析工具,它可以帮助查找java进程dump后的文件。

下载:https://www.eclipse.org/mat/downloads.php
Mac中打开会报错,参看提示的错误log有如下内容:

…
java.lang.IllegalStateException: The platform metadata area could not be written: 
/private/var/folders/k4/knjt7v5x59l25z_tqmvg094r0000gn/T/AppTranslocation/3CBB3175-DD9A-4A3A-B93F-898BA4445384/d/mat.app/Contents/MacOS/workspace/.metadata. 
By default the platform writes its content under the current working directory when the platform is launched. 
Use the -data parameter to specify a different content area for the platform.
…

原因是那个文件是只读文件,解决方案是 选中 mat图标->右键->显示包内容->Contents->Eclipse->MemoryAnalyzer.ini,编辑文件MemoryAnalyzer.ini

-startup
../Eclipse/plugins/org.eclipse.equinox.launcher_1.5.0.v20180512-1130.jar
-data
/Users/zero/logs
--launcher.library
../Eclipse/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.700.v20180518-1200
-vmargs
-Xmx4096m
-Dorg.eclipse.swt.internal.carbon.smallFonts
-XstartOnFirstThread

添加data参数,注意data参数和路径必须在两个不同的行,data参数必须放在Laucher之前。为了防止dump文件太大MAT打不开,顺带把-Xmx调大一点。


Overview:以饼状图的形式列举出了程序内存消耗的一些基本信息,其中每一种不同颜色的饼块都代表了不同比例的内存消耗情况。
Histogram:可以列出内存中的对象,对象的个数以及大小。
Dominator Tree:可以列出那个线程,以及线程下面的那些对象占用的空间。
Top consumers:通过图形列出最大的object。
Leak Suspects:通过MA自动分析泄漏的原因。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值