如何使用android studio分析内存 [英] How to analyze memory using android studio
问题描述
最近从eclipse切换到android studio.如何在android studio中检查应用程序堆和内存分配?在 Eclipse 中,我们有 MAT 工作室中是否有任何东西可以检查堆转储、hprof 文件?
我会用简单的方法来解释它:
首先,您需要安装 MAT ( download ) 或使用:
<块引用>brew cask install memoryanalyzer
在 Android Studio 中打开 Android Device Monitor 或 DDMS.
选择您的流程com.example.etc.."
点击进程列表上方的更新堆.
在右侧面板中,选择堆"选项卡.
点击 Cause GC.
单击进程列表上方的转储 HPROF 文件.
当我们下载文件 HPROF 时,我们必须打开终端并运行此命令以生成文件以使用 MAT 打开它.
打开终端并运行此命令
<块引用>
./hprof-conv path/file.hprof exitPath/heap-converted.hprof
命令hprof-conv"在sdk的platform-tools文件夹中.
- 并且ready和MAT可以打开和打开转换后的文件(heap-converted.hprof).
Recently switch to android studio from eclipse. How to check app heap and memory allocation in android studio? In Eclipse we have MAT is there anything in the studio to check heap dump, hprof file?
I'll explain it in an easy way with steps:
First, you have install MAT ( download ) or use:
brew cask install memoryanalyzer
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/heap-converted.hprof
The command "hprof-conv" is in the platform-tools folder of the sdk.
- And ready and MAT can open and open the converted file ( heap-converted.hprof ) .
这篇关于如何使用android studio分析内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!