Refcount/Memory issues
Created by: mkassner
I m not versed with Pyhton refcounting and memory management but I have experienced some problems with av.VideoFrame
In my application I save numpy arrays to a video file using pyav. For this I call:
frame = av.VideoFrame(input_frame.width,input_frame.height,'bgr24')
to create a frame for each image.
Since this is done inside a fn that is called continuously, I expect frame to go out of scope and be garbage collected. On MacOS this is the case and I don't have any trouble.
However on Linux I quickly run out of memory (I can watch the python process growing in memory use until the system hangs.)
A simple workaround is creating a single instance of frame
attaching it to self.
and re-using it by updating the planes.
Any ideas why this happens when I make new frames?