-
Notifications
You must be signed in to change notification settings - Fork 102
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
Memory leak #16
Comments
Hi, thanks for submitting this. I knew that issue and I tried once in the past to fix it with no success. I'm afraid is from FFmpeg linked libraries and it's not easy to identify it but I will give another try in the next update. |
Hi, Today i am trying to debug but no luck! |
Add a method Close and call before Open() to release memory of previous file: |
I would bet that is the codecs (probably the video codec), but it's not that easy to free an ffmpeg resource. It will cause stack overflows and other mem leaks and it will crash the whole application. And yes a code clean up is required. But, I left like that after a created DecoderContext until I will finish it and tested :) I will close this for now as it is not critical one. And we re-open in the future if required! |
After longtime testing, i confirm that: by remove "hasMoreFrames = true" the memory does not increase by time. |
That was a very nice catch! Just found some time and tested. I can confirm that it was the one was causing the mem leak. Not sure yet what I messed up there, probably misused with AVERROR(EAGAIN) combination. |
Just also confirmed that by removing it will cause issues on many videos. This is how decoding is suppose to work. Just need to find (probably the pkt) what I'm missing to dispose. I thought it is required only for draining but I was wrong. |
Hi, Please try this: public int GetNextFrame(out AVMediaType mType)
|
OK. Finally, I think i fixed that the right way. Just replace the line at the end of the function
with
|
Hi,
With 1 video: 3840x2160, 15 fps, duration 15 minute.
First time open this video: the memory consumption from 218 to 228 MB. After video finished, memory still 228 MB
Second time: memory increase from 228-> 239 MB,...
....
The text was updated successfully, but these errors were encountered: