Как устранить утечку в androidx.media.MediaBrowserServiceCompat?

Утечка это:

      19583-19583/com.example D/LeakCanary: ​
┬───
│ GC Root: Global variable in native code
│
├─ android.service.media.MediaBrowserService$ServiceBinder instance
│    Leaking: UNKNOWN
│    Retaining 1.3 kB in 12 objects
│    this$0 instance of androidx.media.MediaBrowserServiceCompat$MediaBrowserServiceImplApi26$MediaBrowserServiceApi26
│    ↓ MediaBrowserService$ServiceBinder.this$0
│                                        ~~~~~~
├─ androidx.media.MediaBrowserServiceCompat$MediaBrowserServiceImplApi26$MediaBrowserServiceApi26 instance
│    Leaking: YES (Service not held by ActivityThread)
│    Retaining 798 B in 11 objects
│    mBase instance of com.example.service.music.MusicService
│    ↓ ContextWrapper.mBase
╰→ com.example.service.music.MusicService instance
​     Leaking: YES (ObjectWatcher was watching this because com.example.service.music.MusicService
​     received Service#onDestroy() callback and Service not held by ActivityThread)
​     Retaining 96.2 kB in 203 objects
​     key = e494c672-220e-4906-a94c-934ab7b33259
​     watchDurationMillis = 5302
​     retainedDurationMillis = 281
​     mApplication instance of com.example.MyApplication
​     mBase instance of android.app.ContextImpl

METADATA

Build.VERSION.SDK_INT: 29
Build.MANUFACTURER: Google
LeakCanary version: 2.8.1
App process name: com.example
Stats: LruCache[maxSize=3000,hits=48809,misses=129505,hitRate=27%]
RandomAccess[bytes=6034785,reads=129505,travel=66210665221,range=26249675,size=34651913]
Analysis duration: 5090 ms

[ОБНОВИТЬ]:

Вот ссылка на демонстрационный проект с ошибкой: https://github.com/Kolyall/MediaBrowserServiceLeak(в релизах app-debug.apk)

0 ответов

Другие вопросы по тегам