*** glibc检测到***:free():指针c ++无效

时间:2015-07-13 01:25:13

标签: c++ memory profiling release gprof

尝试执行以下代码时遇到了一些问题:https://github.com/Itseez/opencv/blob/master/samples/cpp/facedetect.cpp

在内存分配中进行了这种修改:

for(;;)
{
 //   IplImage* iplImg = cvQueryFrame( capture );
        IplImage *iplImg = NULL ;
        iplImg = new IplImage ;
        iplImg = cvQueryFrame( capture);
   frame = cv::cvarrToMat(iplImg);
    if( frame.empty() )
        break;
    if( iplImg->origin == IPL_ORIGIN_TL )
        frame.copyTo( frameCopy );
    else
        flip( frame, frameCopy, 0 );
   // delete iplImg;
    free(iplImg);
    iplImg = NULL;
    detectAndDraw( frameCopy, cascade, nestedCascade, scale, tryflip );

    if( waitKey( 10 ) >= 0 )
        goto _cleanup_;
}

*错误 检测到glibc :./ facedetect free():无效指针c ++ *

我已经使用gprof来了解我的函数的执行时间 here is the output of gprof 我想减少发布和detectAndDraw函数所花费的时间:p 注意:c ++中的手动内存管理比自动内存更好吗? +使用删除而不是免费没有解决我的问题 谢谢你的帮助:))

0 个答案:

没有答案