内存泄漏与片段和数据绑定

时间:2019-05-02 15:22:32

标签: leakcanary

LeakingInstance(referenceKey=1e607240-1c36-4bf0-a385-980207f9b712, referenceName=, instanceClassName=com.test.android.dashboard.DashboardFragment, watchDurationMillis=5191, excludedLeak=false, leakTrace=
┬
├─ android.widget.Toast
│    Leaking: NO (it's a GC root)
│    ↓ Toast.mContext
├─ com.test.android.main.MainActivity
│    Leaking: NO (Activity#mDestroyed is not true)
│    ↓ MainActivity.contentView
├─ com.test.android.views.FragmentContainerLayout
│    Leaking: NO (View#mAttachInfo is not null)
│    View.mID=R.id.content (2131362081)
│    View.mWindowAttachCount=1
│    ↓ FragmentContainerLayout.mPreSortedChildren
│                              ~~~~~~~~~~~~~~~~~~
├─ java.util.ArrayList
│    Leaking: UNKNOWN
│    ↓ ArrayList.elementData
│                ~~~~~~~~~~~
├─ java.lang.Object[]
│    Leaking: UNKNOWN
│    ↓ array Object[].[0]
│                     ~~~
├─ androidx.constraintlayout.widget.ConstraintLayout
│    Leaking: UNKNOWN
│    View.mID=R.id.dashboard (2131362134)
│    View.mWindowAttachCount=1
│    ↓ ConstraintLayout.mKeyedTags
│                       ~~~~~~~~~~
├─ android.util.SparseArray
│    Leaking: UNKNOWN
│    ↓ SparseArray.mValues
│                  ~~~~~~~
├─ java.lang.Object[]
│    Leaking: UNKNOWN
│    ↓ array Object[].[0]
│                     ~~~
├─ com.test.android.databinding.DashboardFragmentBindingImpl
│    Leaking: UNKNOWN
│    ↓ DashboardFragmentBindingImpl.mLifecycleOwner
│                                   ~~~~~~~~~~~~~~~
├─ androidx.fragment.app.Fragment$3
│    Leaking: UNKNOWN
│    Anonymous class implementing androidx.lifecycle.LifecycleOwner
│    ↓ Fragment$3.this$0
│                 ~~~~~~
╰→ com.test.android.dashboard.DashboardFragment
​     Leaking: YES (Fragment#mFragmentManager is null)
, retainedHeapSize=null)```

1 个答案:

答案 0 :(得分:0)

此错误已被记录并正在处理:https://issuetracker.google.com/issues/119661177