xiaohaibin / XBanner

:fire:【图片轮播】支持图片无限轮播,支持AndroidX、自定义指示点、显示提示文字、切换动画、自定义布局,一屏多显、视频图片混合轮播等功能
Apache License 2.0
2.18k stars 351 forks source link

VideoImageActivity 发生了内存泄露,我应该怎么去解决它,有没有大佬帮忙看一下,求求了 #235

Open CandyTek opened 9 months ago

CandyTek commented 9 months ago

┬─── │ GC Root: Global variable in native code │ ├─ com.oppo.media.OppoMediaPlayer instance │ Leaking: UNKNOWN │ Retaining 104.5 kB in 1803 objects │ mContext instance of com.stx.xhb.demo.MyApplication │ ↓ OppoMediaPlayer.mPlayer │ ~~~ ├─ android.media.MediaPlayer instance │ Leaking: UNKNOWN │ Retaining 103.7 kB in 1782 objects │ mContext instance of com.stx.xhb.demo.MyApplication │ ↓ MediaPlayer.mOnBufferingUpdateListener │ ~~~~~~ ├─ xyz.doikki.videoplayer.player.AndroidMediaPlayer instance │ Leaking: UNKNOWN │ Retaining 102.3 kB in 1735 objects │ mAppContext instance of com.stx.xhb.demo.MyApplication │ ↓ AbstractPlayer.mPlayerEventListener │ ~~~~ ├─ xyz.doikki.videoplayer.player.VideoView instance │ Leaking: YES (View.mContext references a destroyed activity) │ Retaining 102.3 kB in 1734 objects │ View is part of a window view hierarchy │ View.mAttachInfo is null (view detached) │ View.mID = R.id.player │ View.mWindowAttachCount = 1 │ mContext instance of com.stx.xhb.demo.VideoViewActivity with mDestroyed = │ true │ ↓ View.mContext ╰→ com.stx.xhb.demo.VideoViewActivity instance ​ Leaking: YES (ObjectWatcher was watching this because com.stx.xhb.demo. ​ VideoViewActivity received Activity#onDestroy() callback and ​ Activity#mDestroyed is true) ​ Retaining 47.4 kB in 759 objects ​ key = c81f388c-db7a-45df-aea2-3b83e8228403 ​ watchDurationMillis = 7846 ​ retainedDurationMillis = 2845 ​ mApplication instance of com.stx.xhb.demo.MyApplication ​ mBase instance of android.app.ContextImpl

METADATA

Build.VERSION.SDK_INT: 29 Build.MANUFACTURER: OPPO LeakCanary version: 2.12 App process name: com.stx.xhb.xbanner Class count: 12926 Instance count: 106566 Primitive array count: 77640 Object array count: 11981 Thread count: 35 Heap total bytes: 14838804 Bitmap count: 42 Bitmap total bytes: 12061122 Large bitmap count: 0 Large bitmap total bytes: 0 Stats: LruCache[maxSize=3000,hits=31852,misses=64421,hitRate=33%] RandomAccess[bytes=3298533,reads=64421,travel=20850474448,range=17319375,size=22 481411] Analysis duration: 3943 ms

xiaohaibin commented 4 months ago

context 导致的内存泄露