Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

视频缓冲时退出页面导致内存泄露 #3910

Closed
YumengNevix opened this issue Dec 28, 2023 · 1 comment
Closed

视频缓冲时退出页面导致内存泄露 #3910

YumengNevix opened this issue Dec 28, 2023 · 1 comment

Comments

@YumengNevix
Copy link

(!!!!请务必务必按照issue模板,修改 后提交问题!!!!,不按模板提Isuue删除处理)

(ps 首页问题集锦和demo请先了解一下!)

⚠️提问前建议先看看: https://mp.weixin.qq.com/s/HjSdmAsHuvixCH_EWdvk3Q

问题描述:

在Activity中播放视频,缓冲的时候退出页面, 按照demo中写的:

@Override
void onDestroy() {
    if(isPlay) {
        player.release()
   }
}

由于此时还没有缓冲好,所以isPlay为false,但是AudioManager已经初始化了,所以会导致内存泄漏

这个问题和置顶的那个不一样,置顶的那个issue是AudioManager持有了Activity的Context

出现问题的视频流

所有视频都可以复现

问题机型/系统:

All

GSY依赖版本

Latest

Demo中的复现步骤

问题代码:(如果有)

xxxxxxx

问题log(如果有)


Canary              com.nevix.app                        D  1 APPLICATION LEAKS

References underlined with "~~~" are likely causes.
Learn more at https://squ.re/leaks.

717642 bytes retained by leaking objects
Signature: 26e5ff0df7ac5e916d9a5a090836dbee2048b705
┬───
│ GC Root: Global variable in native code
│
├─ android.media.AudioManager$2 instance
│    Leaking: UNKNOWN
│    Retaining 536 B in 1 objects
│    Anonymous subclass of android.media.IAudioFocusDispatcher$Stub
│    ↓ AudioManager$2.this$0
│                     ~~~~~~
├─ android.media.AudioManager instance
│    Leaking: UNKNOWN
│    Retaining 2.6 kB in 38 objects
│    mApplicationContext instance of com.nevix.app.NevixApp
│    ↓ AudioManager.mAudioFocusIdListenerMap
│                   ~~~~~~~~~~~~~~~~~~~~~~~~
├─ java.util.concurrent.ConcurrentHashMap instance
│    Leaking: UNKNOWN
│    Retaining 444 B in 13 objects
│    ↓ ConcurrentHashMap["android.media.AudioManager@544d56fcom.shuyu.gsyvideoplayer.video.base.GSYVideoView$1@a30e27c"]
│                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
├─ android.media.AudioManager$FocusRequestInfo instance
│    Leaking: UNKNOWN
│    Retaining 188 B in 9 objects
│    ↓ AudioManager$FocusRequestInfo.mRequest
│                                    ~~~~~~~~
├─ android.media.AudioFocusRequest instance
│    Leaking: UNKNOWN
│    Retaining 172 B in 8 objects
│    ↓ AudioFocusRequest.mFocusListener
│                        ~~~~~~~~~~~~~~
├─ com.shuyu.gsyvideoplayer.video.base.GSYVideoView$1 instance
│    Leaking: UNKNOWN
│    Retaining 12 B in 1 objects
│    Anonymous class implementing android.media.AudioManager$OnAudioFocusChangeListener
│    ↓ GSYVideoView$1.this$0

@CarGuo
Copy link
Owner

CarGuo commented Dec 28, 2023

#2267 (comment)

@CarGuo CarGuo closed this as completed Dec 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants