I am investigating a memory pile-up issue in my code.
Code description:
(1) Read images from webcam in real-time.
(2) Based upon some conditions, add these images to a std::vector
(3) std::vector Passed onto another thread for writing a video file.
(4) Resolutions tried at 720p, 540p, 360p.
Issue:
- Memory keeps piling up, inspite of me clearing the std::vector after every .avi file write.
- Already verified that reference count of these images goes down to zero once I clear the vector.
- The above happens only when running at 720p. Not seen at 540p, 360p.
After investigating a lot for memory leaks, I haven't found any.
I have noticed that this problem happens only when CPU is at 100%. Is it possible that OpenCV memory cleanup is unable to run in cases when CPU usage is very high? Has anyboy seen similar problems?
Any insights would be useful.
Also, would be useful to know how OpenCV triggers the routine which does memory cleanup.