-
Notifications
You must be signed in to change notification settings - Fork 361
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
OutputContainer.__del__
is never called.
#427
Comments
I think #370 is a different problem as it applies to input containers. |
As hinted at in chat, my problem may be with CodecContext's not getting dealloced because we don't know how that works. I'm not too concerned with this in any immediate sense for my own stuff, I just restart my camera process every two weeks or so. |
As far as I can tell, the AVStream.codec should get deallocated when we call
|
After some digging around, this simple program triggers a leak according to valgrind: import av
container = av.open('foo.mp4', 'w')
stream = container.add_stream('mpeg4')
container.close() The output looks like:
|
.. and I believe I've found the source of the leak! This is the line which is causing us grief:
We should not call this method, since when https://www.ffmpeg.org/doxygen/3.2/libavcodec_2options_8c_source.html#l00156 The same applies to CodecContext.create. |
We never need to call avcodec_get_context_defaults3 ourselves, calling avcodec_alloc_context3 already takes care of it. If we do call it ourselves again, we get a memory leak since it malloc's some memory for private structures. See discussion in issue #427.
Cython classes use __dealloc__ and not __del__ for their destructors.
Wonderful! |
@jlaine pointed out that
OutputContainer.__del__
is never called, and should be__dealloc__
.Maybe related to #370 and my own problems with my security cameras (in which I'm leaking ~120B of memory on every output file I make (once a minute, which builds up after a few days)).
The text was updated successfully, but these errors were encountered: