android - 如何检查阻止对象符合垃圾收集条件的原因?

标签 android listactivity

我正在使用 Memory Analyzer分析我的程序内存消耗。我有一些大对象,我想在满足某些条件后让它们符合 GC 的条件,实际上,当这些条件发生时,我希望在控制台上看到一行,表明自从我添加了一条日志行以来,这些对象中的任何一个都已完成在重写对象的 finalize 方法中。所以看起来这些对象从来没有 GC,我想跟踪哪些对象持有对那些阻止其 GC 的特定对象的引用。它是怎么做到的?

最佳答案

引用 the documentation :

When you see something suspicious, right-click on the item and select Path To GC Roots > exclude weak references. This opens a new tab that traces the references to that object which is causing the alleged leak.

您可能还对 Patrick Duboy 关于此主题的 Google I|O 2011 演讲感兴趣。这里是the slidesthe video .

关于android - 如何检查阻止对象符合垃圾收集条件的原因?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22282769/

相关文章:

android - 每行具有动态 View 的自定义 ListActivity

android - ProGuard 不是从 Eclipse 运行的吗?

javascript - react native : running JS code from Java Module in background with AlarmManager

android - 后退后 ListView 中的重复值

安卓。 SQLite 异常 : no such column _id

android ListActivity 不适用于自定义适配器

android - 将 ImageView 添加到 ListActivity

android - 在新的 WebView 中显示 HttpResponse(来自处理程序的字符串)

android - Android应用程序中搜索界面的问题

android - webview 中的进度条在页面加载完成后保持加载不隐藏