epic
epic

Reputation: 1443

LeakActivity Leaked showing on Leak Canary

This activity is not part of my app and it keeps showing on Leak Canary app.

it doesnt even seems related to what activity i run and if i opened the app at all.

i got this message total of 6 times during last 12 hours

Can someone help to understand it?

LibraryLeak(className=leakcanary.internal.activity.LeakActivity, leakTrace=
┬
├─ android.view.ViewGroup$ViewLocationHolder
│    Leaking: NO (a class is never leaking)
│    GC Root: System class
│    ↓ static ViewGroup$ViewLocationHolder.sPool
│                                          ~~~~~
├─ android.util.Pools$SynchronizedPool
│    Leaking: UNKNOWN
│    ↓ Pools$SynchronizedPool.mPool
│                             ~~~~~
├─ java.lang.Object[]
│    Leaking: UNKNOWN
│    ↓ array Object[].[0]
│                     ~~~
├─ android.view.ViewGroup$ViewLocationHolder
│    Leaking: UNKNOWN
│    ↓ ViewGroup$ViewLocationHolder.mRoot
│                                   ~~~~~
├─ android.widget.ListView
│    Leaking: YES (View.mContext references a destroyed activity)
│    mContext instance of leakcanary.internal.activity.LeakActivity with mDestroyed = true
│    View#mParent is set
│    View#mAttachInfo is null (view detached)
│    View.mWindowAttachCount = 1
│    ↓ ListView.mContext
╰→ leakcanary.internal.activity.LeakActivity
​     Leaking: YES (ListView↑ is leaking and Activity#mDestroyed is true and ObjectWatcher was watching this)
​     key = 53dca871-cc9b-4735-a0fd-98d21465fce0
​     watchDurationMillis = 14202
​     retainedDurationMillis = 9201
, retainedHeapByteSize=132349, pattern=instance field android.view.ViewGroup$ViewLocationHolder#mRoot, description=In Android P, ViewLocationHolder has an mRoot field that is not cleared in its clear() method. Introduced in https://github.com/aosp-mirror/platform_frameworks_base/commit/86b326012813f09d8f1de7d6d26c986a909d Bug report: https://issuetracker.google.com/issues/112792715)```

Upvotes: 4

Views: 1371

Answers (1)

Pierre-Yves Ricau
Pierre-Yves Ricau

Reputation: 8349

This is a know leak in the Android framework (ViewGroup.ViewLocationHolder) : https://github.com/square/leakcanary/issues/1081

LeakCanary actually identifies it as such, which is why it's reported as a "LibraryLeak". See that thread for ways to maybe fix it (it's hard because it's a bug in the android framework).

Upvotes: 3

Related Questions