【发布时间】:2020-09-01 14:34:56
【问题描述】:
我从 leack canary 获得了这个泄露的转储,但不知何故我不明白如何解决这个问题。
┬───
│ GC Root: System class
│
├─ android.view.inputmethod.InputMethodManager class
│ Leaking: NO (InputMethodManager↓ is not leaking and a class is never leaking)
│ ↓ static InputMethodManager.sInstance
├─ android.view.inputmethod.InputMethodManager instance
│ Leaking: NO (InputMethodManager is a singleton)
│ ↓ InputMethodManager.mCurrentInputConnection
│ ~~~~~~~~~~~~~~~~~~~~~~~
├─ com.android.internal.widget.EditableInputConnection instance
│ Leaking: UNKNOWN
│ ↓ EditableInputConnection.mTargetView
│ ~~~~~~~~~~~
├─ androidx.appcompat.widget.AppCompatEditText instance
│ Leaking: YES (View detached and has parent)
│ mContext instance of .android.SIActivity with mDestroyed = false
│ View#mParent is set
│ View#mAttachInfo is null (view detached)
│ View.mID = R.id.name
│ View.mWindowAttachCount = 1
│ ↓ AppCompatEditText.mParent
├─ androidx.constraintlayout.widget.ConstraintLayout instance
│ Leaking: YES (AppCompatEditText↑ is leaking and View detached and has parent)
│ mContext instance of .android.SIActivity with mDestroyed = false
│ View#mParent is set
│ View#mAttachInfo is null (view detached)
│ View.mID = R.id.containerName
│ View.mWindowAttachCount = 1
│ ↓ ConstraintLayout.mParent
├─ androidx.constraintlayout.widget.ConstraintLayout instance
│ Leaking: YES (ConstraintLayout↑ is leaking and View detached and has parent)
│ mContext instance of .android.SIActivity with mDestroyed = false
│ View#mParent is set
│ View#mAttachInfo is null (view detached)
│ View.mWindowAttachCount = 1
│ ↓ ConstraintLayout.mParent
╰→ androidx.core.widget.NestedScrollView instance
Leaking: YES (ObjectWatcher was watching this because .android.si.SILeadInfoFragment received Fragment#onDestroyView() callback (references to its views should be cleared to prevent leaks))
key = a7452263-5234-4656-9425-754c455f1b06
watchDurationMillis = 11855
retainedDurationMillis = 6853
mContext instance of .android.SIActivity with mDestroyed = false
View#mParent is null
View#mAttachInfo is null (view detached)
View.mWindowAttachCount = 1
应用的一些背景知识: 它正在使用来自 jetpack 的导航组件 里面有很多表单处理
任何想法都非常感谢,谢谢!
【问题讨论】:
-
当 Activity 被销毁时,我与
androidx.core.widget.NestedScrollView有类似的泄漏,但我什至没有在任何地方引用 NestedScrollView,而是在我的布局中。嗯...
标签: android android-jetpack leakcanary