Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak in LiteListDemoActivity #803

Open
ljarka opened this issue Jan 7, 2022 · 2 comments
Open

Memory leak in LiteListDemoActivity #803

ljarka opened this issue Jan 7, 2022 · 2 comments
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@ljarka
Copy link

ljarka commented Jan 7, 2022

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

@ljarka ljarka added triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Jan 7, 2022
@arriolac
Copy link
Contributor

arriolac commented Jan 7, 2022

Thanks for reporting. Feel free to send us a PR for it!

@arriolac arriolac added priority: p2 Moderately-important priority. Fix may not be included in next release. and removed triage me I really want to be triaged. labels Jan 7, 2022
@tipa
Copy link

tipa commented Oct 8, 2024

I also noticed that the lite-mode MapView does seem to leak memory unless you call OnDestroy() on it, even though the docs state that it does not need to be called on a lite-mode map: https://developers.google.com/maps/documentation/android-sdk/lite#life_cycle_events

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

3 participants