Re: [ros-users] cvBridge + opencv memory leak problem

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
Delete this message
Reply to this message
Author: Gary Bradski
Date:  
To: ros-users
CC: ros-users
Subject: Re: [ros-users] cvBridge + opencv memory leak problem
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 <> 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
>
> https://lists.sourceforge.net/lists/listinfo/ros-users
> _______________________________________________
> ros-users mailing list
>
> https://code.ros.org/mailman/listinfo/ros-users
>