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

Update index.js #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Update index.js #37

wants to merge 1 commit into from

Conversation

sunjun
Copy link

@sunjun sunjun commented Jul 3, 2020

修复内存泄漏,一直增长

修复内存泄漏,一直增长
@sunjun sunjun mentioned this pull request Jul 3, 2020
@zhw2590582
Copy link
Owner

this.videoframes.length - 1 > index这个判断只是为了确保播放帧的下标在帧数组之内,就算改为>=对于后面的释放也是没影响的,我不用>=的原因是为了最起码让this.videoframes能保留至少一帧,这个也对内存没多大影响。
而且this.videoframes的长度和this.timestamps是一一对应的,要改的话也是要一起改为>=
想加快内存释放可以考虑降低options.videoChunk
但至于为什么还是一直内存过大,我还没找到原因,最近也没怎么去研究(逃)

@sunjun
Copy link
Author

sunjun commented Jul 4, 2020

我是使用直播播放的时候测试出来的这样改的
内存释放那一部分是因为这个条件不满足 所以一直没有被调用
这样改的话 内存释放那部分代码就可以被调用了 所以内存就不会一直增长了
具体你可以测试一下,
内存变大的原因主要原因就是 一直申请而没有释放,没有释放的话就看一下释放那部分代码为啥没有被调用

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

Successfully merging this pull request may close these issues.

2 participants