cv::VideoCapture leaks memory on ethernet cams?

asked 2017-02-08 13:37:05 -0600

Leonardo gravatar image

Hello!

I have been noticing my software memory usage grows (slowly) over time.

I used to believe it was some kind of buffer. But after I let it running overnight, and it crashed because it was out of memory, I had to debug.

I found out if disable grab() and replace retrieve() for a still image, memory usage doesn't grow. A still image runs my algorithm normally.

My software uses 8 VideoCapture instances in RTSP Ethernet Cameras, each one in it's thread, at around 5FPS.

  • After I re-enabled grab(), but not retrieve, the software grown 80MB in 1h23m.
  • After I re-enabled grab and retrieve, the software grown 120MB in 16min.

Question is:

  • Is there a way cv::VideoCapture leaks any memory, for rtsp ethernet cameras?
  • Is there any kind of buffer I can configure?
  • Is there any kind of "clean buffer" I am not aware of?

More info:

  • I sometimes get an error : " [rtsp @ 0xXXXXXXXXXXXX] Too short data for FU-A H.264 RTP packet"
  • I am using OpenCV 3.2 on Linux 64-bits.
  • I have to do 5 grabs for 1 retrieve, so my image don't get delays.

Any help will be appreciated.

edit retag flag offensive close merge delete

Comments

You should post an issue about grab and retrieve

LBerger gravatar imageLBerger ( 2017-02-08 13:41:10 -0600 )edit
1

Done! https://github.com/opencv/opencv/issues/8151 (Issue_8151)

Leonardo gravatar imageLeonardo ( 2017-02-09 04:56:04 -0600 )edit