【发布时间】:2020-03-02 14:56:41
【问题描述】:
在leakcanary 中,有时我将泄漏报告为“库泄漏”
HEAP ANALYSIS RESULT
====================================
0 APPLICATION LEAKS
References underlined with "~~~" are likely causes.
Learn more at https://squ.re/leaks.
====================================
1 LIBRARY LEAKS
Library Leaks are leaks coming from the Android Framework or Google libraries.
Leak 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
66264 bytes retained by leaking objects
Signature: 64becd25d6156daa91df6572a75b6a28ddb1
┬───
│ GC Root: System class
在泄漏的网站上它说:
LibraryLeak at leakcanary website
图书馆泄漏
数据类 LibraryLeak :Leak
HeapAnalyzer 发现的泄漏,这是泄漏的唯一路径 对象需要通过与模式匹配的引用,如 提供给 LibraryLeakReferenceMatcher 实例。这是一个已知的 库代码泄漏,超出您的控制范围。
真的是我无法控制的吗?
可能是我做了什么导致它?
有什么办法可以预防吗?
leakcanry 有时会放置一个链接来报告此内存泄漏,但我没有看到任何响应,这是 android 正常工作的东西吗?如果是,这些问题通常如何解决以及如何跟踪?
如果我确实无法解决或阻止它,有没有办法让leakcanary 忽略LIBRARY LEAKS?
【问题讨论】:
标签: android memory-leaks leakcanary