android内存 工具,Android内存分析工具

使用Android Studio自带的Profile工具

必看的两篇官方文档:

选看的一篇官方文档:

Use MAT for profiling Android memory

First, you have install MAT ( download )

In Android Studio open Android Device Monitor or DDMS.

Select your process “com.example.etc..”

Click Update Heap above the process list.

In the right-side panel, select the Heap tab.

Click in Cause GC.

Click Dump HPROF file above the process list.

When we downloaded the file HPROF, we have to open the Terminal and run this command to generate the file to open it with MAT.

Open terminal and run this command “./hprof-conv path/file.hprof exitPath/1. heap-converted.hprof”. The command “hprof-conv” is in the platform-tools 1. folder of the sdk.

And ready and MAT can open and open the converted file ( heap-converted.hprof ) .

如何在Android Studio 3.0里面打开DDMS?

自从Android Studio进入3.0,DDMS就被偷偷的隐藏起来了。参考下面的文章看如何打开DDMS。

在Android Studio中保存hprof文档

在Android Studio将DDMS偷偷隐藏起来的同时,DDMS的一些工具已经集成到Android Studio里面了。比如这个获取hprof文件的方法。

该方法不需要打开DDMS,直接用Android Studio的Profile工具即可。

Mat启动报错

下载的Mat在打开的时候会报错。错误信息如下:

java.lang.IllegalStateException: The platform metadata area could not be written: /private/var/folders/7b/3wj5jwnd1yg98w2yzmn36qwr0000gq/T/AppTranslocation/C98006F4-54ED-44FB-9F3E-AC7C1EB9519B/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 package,可以找到上面说的MemoryAnalyzer.ini文件

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值