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

[Bug]: ApplicationService._current leaking Activity #2195

Open
archie94 opened this issue Sep 25, 2024 · 0 comments
Open

[Bug]: ApplicationService._current leaking Activity #2195

archie94 opened this issue Sep 25, 2024 · 0 comments

Comments

@archie94
Copy link

What happened?

On the latest SDK 5.1.21 LeakCanary is reporting an Activity memory leak caused by ApplicationService

Steps to reproduce?

Install 5.1.21 SDK version and run the app closing and re-launching it a few times.

What did you expect to happen?

No memory leak when Activity is destroyed.

OneSignal Android SDK version

5.1.21

Android version

14

Specific Android models

No response

Relevant log output

┬───
│ GC Root: System class
│
├─ android.provider.FontsContract class
│    Leaking: NO (App↓ is not leaking and a class is never leaking)
│    ↓ static FontsContract.sContext
├─ c.u.a.App instance
│    Leaking: NO (Application is a singleton)
│    mBase instance of android.app.ContextImpl
│    ↓ Application.mActivityLifecycleCallbacks
│                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~
├─ java.util.ArrayList instance
│    Leaking: UNKNOWN
│    Retaining 441 B in 22 objects
│    ↓ ArrayList[14]
│               ~~~~
├─ com.onesignal.core.internal.application.impl.ApplicationService instance
│    Leaking: UNKNOWN
│    Retaining 246 B in 12 objects
│    _appContext instance of c.u.a.App
│    _current instance of c.u.a.HomeActivity with
│    mDestroyed = true
│    ↓ ApplicationService._current
│                         ~~~~~~~~
╰→ c.u.a.HomeActivity instance
​     Leaking: YES (ObjectWatcher was watching this because c.u.a.HomeActivity received Activity#onDestroy() callback and
​     Activity#mDestroyed is true)
​     Retaining 15.3 MB in 90010 objects
​     key = e28c71aa-1345-4228-be49-2f9484956a7d
​     watchDurationMillis = 45514
​     retainedDurationMillis = 40514
​     mApplication instance of c.u.a.App
​     mBase instance of androidx.appcompat.view.ContextThemeWrapper


### Code of Conduct

- [X] I agree to follow this project's Code of Conduct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant