安卓:泄漏检测与Eclipse内存分析器 [英] Android: Detecting leaks with Eclipse Memory Analyzer

查看:497
本文介绍了安卓:泄漏检测与Eclipse内存分析器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个问题<一href="http://stackoverflow.com/questions/14643895/android-screen-orientation-error-vm-wont-let-us-allocate-x-bytes">Android:屏幕方向错误+虚拟机不会让我们分配X字节 所以我决定下载Eclipse内存分析器。我跑的时候我的错误出现,我有3名犯罪嫌疑人的问题,但我不明白的地方它可能来自。 +我真的不知道,如果我的问题是由于内存泄漏的可能的泄漏只需要2.2; b空间

I have this problem Android: Screen orientation error + VM won't let us allocate x bytes so I decided to download Eclipse Memory Analyzer. I run it when my error is appearing and I have 3 problems suspects but I don't understand where it might come from. + I don't really know if my problem is due to a memory leak as the possible leaks take only 2.2;B space

问题可疑1

2,094 instances of "java.lang.Class", loaded by "<system class loader>" occupy 789,200 (33.76%) bytes. 

Biggest instances:
•class android.text.Html$HtmlParser @ 0x4018d3f0 - 126,632 (5.42%) bytes. 
•class org.apache.harmony.security.fortress.Services @ 0x400e2e58 - 53,880 (2.30%) bytes. 
•class com.android.internal.R$styleable @ 0x400882c0 - 38,072 (1.63%) bytes. 
•class libcore.icu.TimeZones$CachedTimeZones @ 0x40444fa8 - 37,712 (1.61%) bytes. 
•class android.R$styleable @ 0x40055940 - 37,640 (1.61%) bytes. 
•class android.content.res.Resources @ 0x40075178 - 36,032 (1.54%) bytes. 
•class android.text.AutoText @ 0x40178980 - 31,656 (1.35%) bytes. 


Keywords
java.lang.Class

问题可疑2

PROBLEM SUSPECT 2

128 instances of "org.bouncycastle.jce.provider.X509CertificateObject", loaded by "<system class loader>" occupy 455,112 (19.47%) bytes. These instances are referenced from one instance of "java.util.Hashtable$HashtableEntry[]", loaded by "<system class loader>"

Keywords
org.bouncycastle.jce.provider.X509CertificateObject
java.util.Hashtable$HashtableEntry[]

问题可疑3

PROBLEM SUSPECT 3

6,822 instances of "java.lang.String", loaded by "<system class loader>" occupy 418,104 (17.89%) bytes. 

Keywords
java.lang.String

你觉得我有泄漏?我们可以从我贴说吗? 谢谢

Do you think I have a leak? Can we say it from what I have posted? Thank you

推荐答案

在Android上,我觉得它很容易泄露的活动环境。所以,最经常的方式我用来查找内存泄漏,是打开一个OQL选项卡,并输入选择的​​instanceof android.app.Activity *。然后,你可以看到有多少活动实例在那里,你可以告诉是否有泄漏或不被自己的判断。您也可以在活动实例之一单击鼠标右键,然后单击路径GC' - >'排除所有的软/弱/虚引用。然后,你可以看到引用链中的活动。 祝你好运!

On Android, I think it quite easy to leak an Activity context. So the most frequently way I used to find a memory leak, is to open an OQL tab, and input 'select * from instanceof android.app.Activity' . Then you could see how many Activity instances there, and you could tell whether there is a leak or not by your own judgement. Also you could right-click on one of the Activity instances, and click 'Path to GC'--> 'exclude all soft/weak/phantom references'. Then you could see the references to the Activity in chain. Good luck !

这篇关于安卓:泄漏检测与Eclipse内存分析器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆