只要频繁开启、关闭SampleFullScreenActivity就会复现。
2022-06-20 17:05:10.866 18034-18034/com.kuaishou.akdanmaku.sample D/LeakCanary:
┬───
│ GC Root: Thread object
│
├─ android.os.HandlerThread instance
│ Leaking: UNKNOWN
│ Retaining 7.2 MB in 144245 objects
│ Thread name: 'ActionThread'
│ ↓ Thread.threadLocals
│ ~~~~~~~~~~~~
├─ java.lang.ThreadLocal$ThreadLocalMap instance
│ Leaking: UNKNOWN
│ Retaining 788 B in 26 objects
│ ↓ ThreadLocal$ThreadLocalMap.table
│ ~~~~~
├─ java.lang.ThreadLocal$ThreadLocalMap$Entry[] array
│ Leaking: UNKNOWN
│ Retaining 768 B in 25 objects
│ ↓ ThreadLocal$ThreadLocalMap$Entry[5]
│ ~~~
├─ java.lang.ThreadLocal$ThreadLocalMap$Entry instance
│ Leaking: UNKNOWN
│ Retaining 416 B in 15 objects
│ ↓ ThreadLocal$ThreadLocalMap$Entry.value
│ ~~~~~
├─ android.view.Choreographer instance
│ Leaking: UNKNOWN
│ Retaining 388 B in 14 objects
│ ↓ Choreographer.mCallbackQueues
│ ~~~~~~~~~~~~~~~
├─ android.view.Choreographer$CallbackQueue[] array
│ Leaking: UNKNOWN
│ Retaining 132 B in 7 objects
│ ↓ Choreographer$CallbackQueue[1]
│ ~~~
├─ android.view.Choreographer$CallbackQueue instance
│ Leaking: UNKNOWN
│ Retaining 48 B in 2 objects
│ ↓ Choreographer$CallbackQueue.mHead
│ ~~~~~
├─ android.view.Choreographer$CallbackRecord instance
│ Leaking: UNKNOWN
│ Retaining 32 B in 1 objects
│ ↓ Choreographer$CallbackRecord.action
│ ~~~~~~
├─ com.kuaishou.akdanmaku.ui.DanmakuPlayer$FrameCallback instance
│ Leaking: UNKNOWN
│ Retaining 12 B in 1 objects
│ ↓ DanmakuPlayer$FrameCallback.handler
│ ~~~~~~~
├─ com.kuaishou.akdanmaku.ui.DanmakuPlayer$ActionHandler instance
│ Leaking: UNKNOWN
│ Retaining 32 B in 1 objects
│ ↓ DanmakuPlayer$ActionHandler.this$0
│ ~~~~~~
├─ com.kuaishou.akdanmaku.ui.DanmakuPlayer instance
│ Leaking: UNKNOWN
│ Retaining 7.2 MB in 144196 objects
│ ↓ DanmakuPlayer.danmakuView
│ ~~~~~~~~~~~
├─ com.kuaishou.akdanmaku.ui.DanmakuView instance
│ Leaking: YES (View.mContext references a destroyed activity)
│ Retaining 463.7 kB in 6551 objects
│ View is part of a window view hierarchy
│ View.mAttachInfo is null (view detached)
│ View.mID = R.id.danmakuView
│ View.mWindowAttachCount = 1
│ mContext instance of com.kuaishou.akdanmaku.sample.SampleFullScreenActivity with mDestroyed = true
│ ↓ View.mContext
╰→ com.kuaishou.akdanmaku.sample.SampleFullScreenActivity instance
Leaking: YES (ObjectWatcher was watching this because com.kuaishou.akdanmaku.sample.SampleFullScreenActivity
received Activity#onDestroy() callback and Activity#mDestroyed is true)
Retaining 10.8 kB in 288 objects
key = d5c9958a-0d58-43f8-bb83-3cf76d306c52
watchDurationMillis = 25669
retainedDurationMillis = 20669
mApplication instance of android.app.Application
mBase instance of androidx.appcompat.view.ContextThemeWrapper
METADATA
Build.VERSION.SDK_INT: 30
Build.MANUFACTURER: deltainno
LeakCanary version: 2.9.1
App process name: com.kuaishou.akdanmaku.sample
Class count: 18433
Instance count: 581210
Primitive array count: 123341
Object array count: 44375
Thread count: 29
Heap total bytes: 32675955
Bitmap count: 590
Bitmap total bytes: 31502554
Large bitmap count: 0
Large bitmap total bytes: 0
Stats: LruCache[maxSize=3000,hits=100857,misses=458594,hitRate=18%]
RandomAccess[bytes=21134172,reads=458594,travel=136475745955,range=44553460,size=50633639]
Analysis duration: 25892 ms
improvement