[Leak] Toast$TN leaking in Android 11
- Dominant language
- Java
- Stars
- 6.6k
- Forks
- 803
- PR merge metrics
- No merged PRs in 30d
Description
The leak is captured from [LeakCanary](https://square.github.io/leakcanary).
```
┬───
│ GC Root: Global variable in native code
│
├─ android.widget.Toast$TN instance
│ Leaking: UNKNOWN
│ ↓ Toast$TN.mPresenter
│ ~~~~
├─ android.widget.ToastPresenter instance
│ Leaking: UNKNOWN
│ ↓ ToastPresenter.mContext
│ ~~~~
╰→ com.kpstv.yts.ui.activities.FinalActivity instance
Leaking: YES (ObjectWatcher was watching this because com.kpstv.yts.ui.activities.FinalActivity received Activity#onDestroy() callback and Activity#mDestroyed is true)
key = c2fb5f4f-112b-4489-a84e-8b37699b32c1
watchDurationMillis = 6111
retainedDurationMillis = 1110
METADATA
Build.VERSION.SDK_INT: 30
Build.MANUFACTURER: samsung
LeakCanary version: 2.4
App process name: com.kpstv.yts
Analysis duration: 33287 ms
```
This happens when the toast is in the queue (referenced) but the activity or containing fragment (in which it's about to show) goes out of existence. I've tested in on some devices & found out that Samsung devices are hotspots for this leak.
The fix, for now, is to set `allowQueue` to false from `Toasty.Config`.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.