leakcanary - LeakActivity 泄漏显示在 Leak Canary 上

标签 leakcanary

此事件不是我的应用程序的一部分,它一直显示在 Leak Canary 应用程序上。

它甚至似乎与我运行的事件以及我是否打开应用程序无关。

我在过去 12 小时内总共收到了 6 次此消息

有人可以帮助理解吗?

LibraryLeak(className=leakcanary.internal.activity.LeakActivity, leakTrace=
┬
├─ android.view.ViewGroup$ViewLocationHolder
│    Leaking: NO (a class is never leaking)
│    GC Root: System class
│    ↓ static ViewGroup$ViewLocationHolder.sPool
│                                          ~~~~~
├─ android.util.Pools$SynchronizedPool
│    Leaking: UNKNOWN
│    ↓ Pools$SynchronizedPool.mPool
│                             ~~~~~
├─ java.lang.Object[]
│    Leaking: UNKNOWN
│    ↓ array Object[].[0]
│                     ~~~
├─ android.view.ViewGroup$ViewLocationHolder
│    Leaking: UNKNOWN
│    ↓ ViewGroup$ViewLocationHolder.mRoot
│                                   ~~~~~
├─ android.widget.ListView
│    Leaking: YES (View.mContext references a destroyed activity)
│    mContext instance of leakcanary.internal.activity.LeakActivity with mDestroyed = true
│    View#mParent is set
│    View#mAttachInfo is null (view detached)
│    View.mWindowAttachCount = 1
│    ↓ ListView.mContext
╰→ leakcanary.internal.activity.LeakActivity
​     Leaking: YES (ListView↑ is leaking and Activity#mDestroyed is true and ObjectWatcher was watching this)
​     key = 53dca871-cc9b-4735-a0fd-98d21465fce0
​     watchDurationMillis = 14202
​     retainedDurationMillis = 9201
, retainedHeapByteSize=132349, pattern=instance field android.view.ViewGroup$ViewLocationHolder#mRoot, description=In Android P, ViewLocationHolder has an mRoot field that is not cleared in its clear() method. Introduced in https://github.com/aosp-mirror/platform_frameworks_base/commit/86b326012813f09d8f1de7d6d26c986a909d Bug report: https://issuetracker.google.com/issues/112792715)```

最佳答案

这是 Android 框架 (ViewGroup.ViewLocationHolder) 中的一个已知漏洞:https://github.com/square/leakcanary/issues/1081

LeakCanary 实际上将其识别为这样,这就是为什么将其报告为“LibraryLeak”的原因。请参阅该线程以了解修复它的方法(这很难,因为它是 android 框架中的一个错误)。

关于leakcanary - LeakActivity 泄漏显示在 Leak Canary 上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58568875/

相关文章:

android - VideoView 泄漏 Activity

android - LeakCanary DialogFragment 泄漏检测

java - FragmentPagerAdapter 中的 RecyclerView 泄漏

Android 泄漏金丝雀 - 泄漏空 Activity

android - 修复由 Leak Canary 发现的 Activity 内存泄漏

android - LeakCanary ContentObserver$传输

android - 保留 fragment 泄漏

android - 读取 LeakCanary 日志

android - Leakcanary、Recyclerview 泄漏适配器

android - Dagger 2 如何处理不再需要的注入(inject)字段?