leaked nestedscrollView using fragment and navigation component

Viewed 243

I have this leaked dump from leack canary but somehow I dont understand on how to resolve this.

┬───
│ 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

Some background on the apps: it is using navigation component from jetpack lots of form processing inside

Any idea much appreciated, thank you !

1 Answers

This question seem old but I ran into this time to time so here is what I know so far:

  • I have not found any solution for this except using reflection.
  • LeakCanary 2.6 has marked this as a library leak (of course it is still a leak that could crash your app due to the OutOfMemory exception).
Related