Memory Management of VideoFrame image buffers #893
Unanswered
FirefoxMetzger
asked this question in
1. Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This issue started from a comment in a PR: #788 (comment)
I'm wondering about the memory ownership/management model in PyAV. For example, the following works without any complaints:
However, I wonder if this is actually undefined behavior because FFmpeg/libav doesn't know about
no_copy_array
. Hence, when I calldel frame
(which internally callsav_freep
) then the buffer should be freed andno_copy_array
should point into unallocated memory which is undefined behavior. I suspect a similar situation would happen if the buffer came fromcontainer.decode()
instead of me creating it manually (in which case the default would be that the buffer is internally ref-counted and freed by FFmpeg).So my question is if PyAV does any explicit memory management here, and if not if it relies on python's gc or ffmpeg's gc (or a mix of the two).
Edit: I just played around with this on something more sizable (5GB worth of frames). and it correctly allocates and frees memory. This isn't a definite answer, but perhaps a first step towards it.
Beta Was this translation helpful? Give feedback.
All reactions