memory leak, original numpy array not deallocated
Closed this issue · 1 comments
martin-xavier commented
Hello,
I tracked down what I believe is a memory leak:
pyboost_cv2_converter.cpp:399->402
if (!needcopy){
m->addref(); // protect the original numpy array from deallocation
// (since Mat destructor will decrement the reference counter)
}
On my setup this works as advertised, the original numpy arrays are never deallocated. :-)
When I feed the converter OpenCV images from a HD webcam, the RAM is quickly overwhelmed.
By commenting out this block, the numpy arrays are properly garbage collected.
I have witnessed no adverse effects thus far.
Setup: Ubuntu 16.04 LTS, Python 2.7.12, OpenCV 2.4.9.1
Witnessed during usage of https://github.com/jskinn/ORB_SLAM2-PythonBindings,
which uses pyboostcvconverter.
Xavier
Algomorph commented
@martin-xavier , thank you so much for tracking this down and reporting it! I'll investigate this until I solve it, let's keep the issue open for now.