[ros-users] cvBridge + opencv memory leak problem

Radu Bogdan Rusu rusu at willowgarage.com
Sat May 22 23:40:15 UTC 2010


The main difference between IplImage and cv::Mat is that you don't need to explicitly deallocate data. When using 
IplImage you have to manually deallocate/free the buffer, which is probably why you're seeing memory leaks right now. 
cv::Mat is part of the new C++ API that OpenCV 2.x provides.


On 05/22/2010 04:36 PM, Chriss Lei wrote:
> Hello.
> I'm using cvbridge to get camera images and using some opencv functions
> for image processing.
> However, memory blows up whenever I use opencv functions on IplImages
> converted from the imgMsgToCv method.
> Using cvCopy, cvCloneImage, cvNormalize, etc... any one of these good'
> ol opencv functions on IplImage blows up the memory.
> So I referred to stereo view.cpp file in
> http://www.ros.org/doc/api/image_view/html/stereo__view_8cpp_source.html#l00340
> It seems like the file uses the new cv::Mat_ data structure to perform
> operations on images.
> Should I always use the new opencv2.1 image data structure( cv::Mat ) if
> I want to work on opencv images converted from sensor_msgs::Image ?
> Or is there a way to work with the IplImages ?
> Thanks.
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users

| Radu Bogdan Rusu | http://rbrusu.com/

More information about the ros-users mailing list