[ros-users] cvBridge + opencv memory leak problem

chriss lei lei.chriss at gmail.com
Sat May 22 23:54:15 UTC 2010


Hello Radu,

I'm well aware of using cvReleaseImage..
Memory leak happens even if I use a single function on IplImage converted
from sensor_msgs.
Here's my callback function to illustrate. Usage of cvCopy here introduces
memory blowup problem.

void callback(const sensor_msgs::CameraInfo::ConstPtr& info,
			    const sensor_msgs::ImageConstPtr& left,
			    const stereo_msgs::DisparityImageConstPtr& disparity_msg)
	{
	
		im_left = left_bridge.imgMsgToCv(left, "passthrough");

		disp_bridge.fromImage(disparity_msg->image, "passthrough");
		dispImg = disp_bridge.toIpl();	
		
		cvShowImage("left", im_left);

		IplImage* test = NULL;
		test = cvCreateImage(cvGetSize(dispImg), dispImg->depth, 1);
		cvCopy(dispImg, test);
		cvShowImage("disp", test);
       }

Also, I'm not supposed to deallocate any IplImages that are converted from
sensor_msgs as described in cvBridge tutorial.
Is there a way to use opencv functions on IplImages and not use cv::Mat ?

-- 
View this message in context: http://ros-users.122217.n3.nabble.com/cvBridge-opencv-memory-leak-problem-tp837144p837162.html
Sent from the ROS-Users mailing list archive at Nabble.com.

------------------------------------------------------------------------------

_______________________________________________
ros-users mailing list
ros-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ros-users



More information about the ros-users mailing list