android-samples
android-samples copied to clipboard
Memory leak in LiteListDemoActivity
I added LeakCanary to sample app, played around with LiteListDemoActivity
and leak canary detects a lot of leaks in this activity.
Environment details
Build.VERSION.SDK_INT: 29
Build.MANUFACTURER: samsung
LeakCanary version: 2.8.1
App process name: com.example.kotlindemos.gms
Steps to reproduce
- Add LeakCanary library to app
- Open LiteListDemo
- Move back to list of samples
- Wait for a report from LeakCanary
Stack trace
┬───
│ GC Root: Global variable in native code
│
├─ ft instance
│ Leaking: UNKNOWN
│ Retaining 2.0 kB in 49 objects
│ ↓ ft.a
│ ~
├─ fu instance
│ Leaking: UNKNOWN
│ Retaining 1.5 kB in 48 objects
│ ↓ fu.g
│ ~
├─ er instance
│ Leaking: UNKNOWN
│ Retaining 1.3 kB in 39 objects
│ ↓ er.a
│ ~
├─ eu instance
│ Leaking: UNKNOWN
│ Retaining 96 B in 6 objects
│ e instance of androidx.multidex.MultiDexApplication
│ ↓ eu.d
│ ~
├─ com.google.maps.api.android.lib6.impl.ew instance
│ Leaking: UNKNOWN
│ Retaining 16 B in 1 objects
│ ↓ ew.b
│ ~
├─ com.google.maps.api.android.lib6.impl.ec instance
│ Leaking: UNKNOWN
│ Retaining 2.9 MB in 26412 objects
│ s instance of androidx.multidex.MultiDexApplication
│ ↓ ec.t
│ ~
├─ java.util.ArrayList instance
│ Leaking: UNKNOWN
│ Retaining 2.9 MB in 26390 objects
│ ↓ ArrayList[0]
│ ~~~
├─ com.google.maps.api.android.lib6.lite.b instance
│ Leaking: UNKNOWN
│ Retaining 27.8 kB in 166 objects
│ ↓ b.b
│ ~
├─ com.google.maps.api.android.lib6.lite.h instance
│ Leaking: UNKNOWN
│ Retaining 27.8 kB in 165 objects
│ ↓ h.c
│ ~
├─ com.google.maps.api.android.lib6.lite.i instance
│ Leaking: UNKNOWN
│ Retaining 24 B in 1 objects
│ ↓ i.a
│ ~
├─ com.google.maps.api.android.lib6.impl.ax instance
│ Leaking: UNKNOWN
│ Retaining 20 B in 1 objects
│ a instance of androidx.multidex.MultiDexApplication
│ b instance of com.example.kotlindemos.LiteListDemoActivity with mDestroyed = true
│ ↓ ax.b
│ ~
╰→ com.example.kotlindemos.LiteListDemoActivity instance
Leaking: YES (ObjectWatcher was watching this because com.example.kotlindemos.LiteListDemoActivity received
Activity#onDestroy() callback and Activity#mDestroyed is true)
Retaining 65.6 kB in 1274 objects
key = a5e2c6a2-7128-451c-916d-47876e3453c7
watchDurationMillis = 12553
retainedDurationMillis = 7552
mApplication instance of androidx.multidex.MultiDexApplication
mBase instance of androidx.appcompat.view.ContextThemeWrapper
Thanks for reporting. Feel free to send us a PR for it!