Memory leak in cv::viz::WImage3D::setImage() (Bug #3961)
Description
Repeatedly calling setImage on a WImage3D widget seems to take a copy of the image data each time. If this function is called in a loop, we get a memory leak.
The example code below replicates the problem on my machine. By the end of the loop, 3GB of memory is required by the application.
#include <opencv2/opencv.hpp> #include <opencv2/viz/vizcore.hpp> #include <iostream> int main(int argc, char* argv[]) { cv::Mat image = cv::Mat::zeros(1024,1024, CV_8UC3); cv::viz::WImage3D imageWidget(image, cv::Size(1.0,1.0)); for(int i = 0; i < 1E3; ++i) { imageWidget.setImage(image); } std::cout << "Press <RETURN> to exit..."; std::cin.get(); return 0; }
Here is a description of my setup:
- OpenCV 2.4.9 (built from source)
- Ubuntu 12.04 x64
- CMake 2.8.12 (built from source)
- Qt 5.3.1 (x64 binary package)
- VTK 6.1.0 (built from source against the same Qt version)
Associated revisions
Merge pull request #3961 from apavlenko:2.4_fix_polylines_empty
History
Updated by Anatoly Baksheev over 10 years ago
- Status changed from New to Done