问题描述
我有一个使用单个Activity和Toothpick / Ktp实现的应用程序。
我为每个片段创建一个作用域,当片段被销毁时将关闭该作用域。此行为在BaseFragment类中完成。
它确实使用ViewBinding。
调用onDestroyedView时,适配器及其侦听器为空。
有人有其他想法可能会从哪里泄漏?还是要搜索的详细信息?
┬───
│ GC Root: Global variable in native code
│
├─ toothpick.Toothpick class
│ Leaking: NO (HomeFragment↓ is not leaking and a class is never leaking)
│ ↓ static Toothpick.MAP_KEY_TO_ScopE
├─ java.util.concurrent.ConcurrentHashMap instance
│ Leaking: NO (HomeFragment↓ is not leaking)
│ ↓ ConcurrentHashMap.table
├─ java.util.concurrent.ConcurrentHashMap$Node[] array
│ Leaking: NO (HomeFragment↓ is not leaking)
│ ↓ ConcurrentHashMap$Node[].[5]
├─ java.util.concurrent.ConcurrentHashMap$Node instance
│ Leaking: NO (HomeFragment↓ is not leaking)
│ ↓ ConcurrentHashMap$Node.key
├─ com.surprise.feature.home.presentation.HomeFragment instance
│ Leaking: NO (Fragment#mFragmentManager is not null)
│ ↓ HomeFragment.mLifecycleRegistry
│ ~~~~~~~~~~~~~~~~~~
├─ androidx.lifecycle.LifecycleRegistry instance
│ Leaking: UNKNowN
│ ↓ LifecycleRegistry.mObserverMap
│ ~~~~~~~~~~~~
├─ androidx.arch.core.internal.FastSafeIterableMap instance
│ Leaking: UNKNowN
│ ↓ FastSafeIterableMap.mHashMap
│ ~~~~~~~~
├─ java.util.HashMap instance
│ Leaking: UNKNowN
│ ↓ HashMap.table
│ ~~~~~
├─ java.util.HashMap$Node[] array
│ Leaking: UNKNowN
│ ↓ HashMap$Node[].[8]
│ ~~~
├─ java.util.HashMap$Node instance
│ Leaking: UNKNowN
│ ↓ HashMap$Node.key
│ ~~~
├─ androidx.viewpager2.adapter.FragmentStateAdapter$5 instance
│ Leaking: UNKNowN
│ Anonymous class implementing androidx.lifecycle.LifecycleEventObserver
│ ↓ FragmentStateAdapter$5.this$0
│ ~~~~~~
├─ com.surprise.common.presentation.view.adapter.PagerAdapter instance
│ Leaking: UNKNowN
│ ↓ PagerAdapter.mFragments
│ ~~~~~~~~~~
├─ androidx.collection.LongSparseArray instance
│ Leaking: UNKNowN
│ ↓ LongSparseArray.mValues
│ ~~~~~~~
├─ java.lang.Object[] array
│ Leaking: UNKNowN
│ ↓ Object[].[0]
│ ~~~
╰→ com.surprise.feature.section.presentation.SectionFragment instance
Leaking: YES (ObjectWatcher was watching this because com.surprise.feature.section.presentation.SectionFragment received Fragment#onDestroy() callback and Fragment#mFragmentManager is null)
key = a4fbee3f-a0a2-464d-93ef-ae22a962a337
watchDurationMillis = 126195
retainedDurationMillis = 121174
MetaDATA
Build.VERSION.SDK_INT: 29
Build.MANUFACTURER: Google
LeakCanary version: 2.4
App process name: com.surprise.qual.pushdev.debug
Analysis duration: 622822 ms
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)