LeakCanary没有提供足够的信息来识别泄漏



我正在使用LeakCanary,但堆分析结果没有提供足够的信息来检测任何泄漏。它只提到活动正在泄漏。

D/LeakCanary: ​
====================================
HEAP ANALYSIS RESULT
====================================
1 APPLICATION LEAKS

References underlined with "~~~" are likely causes.
Learn more at https://squ.re/leaks.

298153 bytes retained by leaking objects
Signature: a610bac3ef989ac5dc5a69244fc2882de5617
┬───
│ GC Root: System class
│
├─ android.provider.FontsContract class
│    Leaking: NO (MyApplication↓ is not leaking and a class is never leaking)
│    ↓ static FontsContract.sContext
├─ com.example.MyApplication instance
│    Leaking: NO (Application is a singleton)
│    mBoundService instance of com.example.services.SessionService
│    mBase instance of android.app.ContextImpl
│    ↓ Application.mLoadedApk
│                  ~~~~~~~~~~
├─ android.app.LoadedApk instance
│    Leaking: UNKNOWN
│    Retaining 302.8 kB in 4641 objects
│    mApplication instance of com.example.MyApplication
│    ↓ LoadedApk.mReceivers
│                ~~~~~~~~~~
├─ android.util.ArrayMap instance
│    Leaking: UNKNOWN
│    Retaining 301.7 kB in 4615 objects
│    ↓ ArrayMap.mArray
│               ~~~~~~
├─ java.lang.Object[] array
│    Leaking: UNKNOWN
│    Retaining 301.7 kB in 4613 objects
│    ↓ Object[].[2]
│               ~~~
╰→ com.example.activities.SelectActivity instance
​     Leaking: YES (ObjectWatcher was watching this because com.example.activities.SelectActivity received
​     Activity#onDestroy() callback and Activity#mDestroyed is true)
​     Retaining 298.2 kB in 4579 objects
​     key = 68660c30-bc17-4a74-a5e2-c54f6d676c59
​     watchDurationMillis = 5185
​     retainedDurationMillis = 183
​     mApplication instance of com.example.MyApplication
​     mBase instance of androidx.appcompat.view.ContextThemeWrapper
====================================
0 LIBRARY LEAKS

从这个跟踪中我只知道SelectActivity正在泄漏。但我不明白为什么?活动本身有1000多行,我希望除了浏览每一行并检查可能的泄漏候选者之外,是否还有其他捷径。

活动是否注册了任何广播接收器?leaktrace显示LoadedApk.mReceivers,它是接收器到接收器调度器的ArrayMap,活动是接收器调度器。

相关内容

  • 没有找到相关文章

最新更新