PyImageSearch / imutils

A series of convenience functions to make basic image processing operations such as translation, rotation, resizing, skeletonization, and displaying Matplotlib images easier with OpenCV and Python.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

VideoStream consumes memory even after stop

mpimentel04 opened this issue · comments

Hi,

I'm using the function, that will consume memory after execution:

vs = VideoStream('rtsp://admin:admin123@192.168.0.195/').start()

even after I finish with the function, CPU consumption is reset to zero, however memory consumption continues:

vs.stop()

The memory consumption is only reset when I stop the program.

Is there a function to solve this?

Thanks

Hey, @mpimentel04 I am new to this repo but by looking at the source code for the mentioned function. I guess it's an inbuild Lock in python called GIL(Global Interpreter Lock) which is responsible for the above memory consumption. I am not sure but It may be the case.

Hi @soumya17052002

is there any way to prevent this?

After I analyzed it, I realized that memory consumption happens at that point:

image

@mpimentel04 Sorry for the wrong interpretation earlier, After a little research, I found the problem happens when VideoCapture() is used.
Problem: It can be better said a memory leak happens when we use the above function in OpenCV.

https://github.com/opencv/opencv/issues/5715

Even if this issue is closed problem still persists on the recent version of OpenCV.
It's a problem of OpenCV I guess not a python or this code-related problem.

Thanks @soumya17052002

Wow, it seems to be an old opencv problem.

I will investigate and try to find some solution.

Thank you for your help