简体   繁体   English

如何使用TraceView进行Android应用程序的内存分析

[英]How to use TraceView for memory profiling for android application

I am referencing this to memory profiling of my application, when I launched TraceView with my trace file, there are several colors and items shows on TraceView window. 我引用对我的应用程序的内存分析,当我发起TraceView我的跟踪文件,有几种颜色和物品上TraceView窗口显示。

So how can I understand where memory leaks, and what is means of colors. 因此,我如何才能了解内存泄漏的位置以及色彩的含义。

I don't think you should use TraceView for memory leaks finding. 我不认为您应该使用TraceView进行内存泄漏查找。 It's a tool for getting information about performance and memory usage of applications. 它是用于获取有关应用程序性能和内存使用情况的信息的工具。 Try Memory Analyzer Plugin for Eclipse . 尝试使用Eclipse的Memory Analyzer插件 You can make a dump of your app's memory with Dump HPROF file button in DDMS and look for memory leaks in this dump using MAT. 您可以使用DDMS中的“ 转储HPROF文件”按钮对应用程序的内存进行转储 ,然后使用MAT查找此转储中的内存泄漏。

UPDATE: 更新:
When the memory dump is made you'll see MAT 's Getting Started Wizard with Leak Suspects Report radio button checked. 进行内存转储后,您会看到MAT的入门向导”,其中有“ 泄漏报告”单选按钮。 Click Finish button and you'll see Leak Suspects window. 单击完成按钮,您将看到“ 泄漏可疑物”窗口。 There will be a diagram of memory usage and a list of potential leaks. 将有一个内存使用图和潜在的泄漏列表。 Some leaks are false-positive. 一些泄漏是假阳性。 If you think that a particular leak is the real one, you can click on a Detail link to get more information about this leak. 如果您认为特定的泄漏是真实的泄漏,则可以单击“ 详细信息”链接以获取有关此泄漏的更多信息。

When the Detail tab opens you will see a path to a leaked object. 当“ 详细信息”选项卡打开时,您将看到泄漏对象的路径。 You can click any objects in the path and get some useful information about these objects. 您可以单击路径中的任何对象,并获取有关这些对象的一些有用信息。 For example you can get a list of objects that have a reference to the selected object ( List objects -> with outgoing reference ). 例如,您可以获得具有对所选对象的引用的对象的列表列表对象 -> 具有传出引用 )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM