I have a python script (3.7.3) that uses OpenCV (4.1.1) with GStreamer backend to stream live RTSP URL.
After VideoCapture, frames are read and stored in a queue. The queue size is 10. If the queue gets full, the oldest frame is popped out and a new frame is pushed.
import cv2
import numpy as np
from queue import Queue
q = Queue(10)
vcap = cv2.VideoCapture(rtsp://url)
while True:
status, image = vcap.read()
print("READ IMAGE")
if(status):
if(q.full()):
q.get()
print("Skipping Queue")
q.put({'image': np.array(image)})
del image
What happens when I do q.get()? Does the frame gets deleted from memory after getting popped, or stays in memory? Or do I need to explicitly delete that by using del? I am observing memory usage increasing over time in my code