[Bug]: ApplicationService._current leaking Activity
Opened this issue · 0 comments
archie94 commented
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