[ros-users] cvBridge + opencv memory leak problem

Gary Bradski bradski at willowgarage.com
Sun May 23 05:13:40 UTC 2010


Here's a snippet from something I just wrote

Mat scratch;  // part of the state of the node -- if the image size stays
constant, it will only allocate once

    //PROCESS THE IMAGE
    if (img_bridge_.fromImage(*msg, "bgr8"))
    {
        Mat I = img_bridge_.toIpl();
        I.copyTo(scratch);
. . .
you don't have to deallocate ever (you could ... using scratch.release() but
you almost never need to



On Sat, May 22, 2010 at 6:39 PM, chriss lei <lei.chriss at gmail.com> wrote:

>
> Thank you.
>
> I obviously forgot to release the image.
>
> Also, converting cv::Mat into IplImage also worked.
>
> I guess I'll slowly migrate towards using cv::Mat.
> --
> View this message in context:
> http://ros-users.122217.n3.nabble.com/cvBridge-opencv-memory-leak-problem-tp837144p837271.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
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ros.org/pipermail/ros-users/attachments/20100522/e2db3a81/attachment-0003.html>


More information about the ros-users mailing list