googlemaps-samples / googlemaps-samples/android-samples

Memory leak in LiteListDemoActivity

Open
#803 2 comments 0 reactions 1 assignee View on GitHub

@arriolac is already working on this.

Since Jan 7, 2022.

priority: p2 type: bug
Dominant language
Kotlin
Stars
2.5k
Forks
3.1k
Avg merge
3d 54m
Merged PRs (30d)
4

Description

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
  1. Add LeakCanary library to app
  2. Open LiteListDemo
  3. Move back to list of samples
  4. 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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.