Протестировано на:
- Pixel 7 Pro API 34
- Pixel 4 API 31
- Pixel 3a API 28
- Pixel 4 API 21 (отчет немного отличается, но я думаю, что причина в то же самое)
- LeakCanary 2.13
│ GC Root: System class
│
├─ android.provider.FontsContract class
│ Leaking: NO (ExampleApplication↓ is not leaking and a class is
│ never leaking)
│ ↓ static FontsContract.sContext
├─ com.example.ExampleApplication instance
│ Leaking: NO (Application is a singleton)
│ mBase instance of android.app.ContextImpl
│ ↓ Application.mLoadedApk
│ ~~~~~~~~~~
├─ android.app.LoadedApk instance
│ Leaking: UNKNOWN
│ Retaining 206.8 kB in 4052 objects
│ mApplication instance of com.example.
│ ExampleApplication
│ Receivers
│ ..ExampleApplication@321728936
│ ....VisibilityTracker@329242680
│ ....aF@329242760
│ ....d@329242824
│ ....RF@329242896
│ ....ProxyChangeListener$ProxyReceiver@329242968
│ ↓ LoadedApk.mServices
│ ~~~~~~~~~
├─ android.util.ArrayMap instance
│ Leaking: UNKNOWN
│ Retaining 203.2 kB in 4011 objects
│ ↓ ArrayMap.mArray
│ ~~~~~~
├─ java.lang.Object[] array
│ Leaking: UNKNOWN
│ Retaining 203.2 kB in 4009 objects
│ ↓ Object[2]
│ ~~~
├─ android.app.ContextImpl instance
│ Leaking: UNKNOWN
│ Retaining 6.2 kB in 86 objects
│ mOuterContext instance of android.app.ContextImpl
│ ContextImpl.mOuterContext == ContextImpl.this: not tied to any particular
│ lifecycle
│ ↓ ContextImpl.mAutofillClient
│ ~~~~~~~~~~~~~~~
├─ android.view.autofill.AutofillClientController instance
│ Leaking: UNKNOWN
│ Retaining 26 B in 1 objects
│ mActivity instance of com.example.ui.ExampleActivity
│ with mDestroyed = true
│ ↓ AutofillClientController.mActivity
│ ~~~~~~~~~
╰→ com.example.ui.ExampleActivity instance
Leaking: YES (ObjectWatcher was watching this because com.example.ui.ExampleActivity received Activity#onDestroy() callback
and Activity#mDestroyed is true)
Retaining 51.8 kB in 1004 objects
key = a1f4ff6a-48ea-4ba9-90c4-7f746b99af89
watchDurationMillis = 7757
retainedDurationMillis = 2755
mApplication instance of com.example.ExampleApplication
mBase instance of androidx.appcompat.view.ContextThemeWrapper
METADATA
Build.VERSION.SDK_INT: 34
Build.MANUFACTURER: Google
LeakCanary version: 2.13
App process name: com.example
Class count: 35752
Instance count: 351728
Primitive array count: 189083
Object array count: 44181
Thread count: 64
Heap total bytes: 39264516
Bitmap count: 35
Bitmap total bytes: 2247331
Large bitmap count: 0
Large bitmap total bytes: 0
Stats: LruCache[maxSize=3000,hits=166095,misses=321890,hitRate=34%]
RandomAccess[bytes=15827352,reads=321890,travel=107139495512,range=47678011,size
=58241724]
Analysis duration: 26210 ms
Подробнее здесь: https://stackoverflow.com/questions/783 ... lementatio