Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 41027

*** glibc detected *** : free() : invalid pointer c++ [duplicate]

$
0
0
I'm having some trouble when trying to execute the following code :https://github.com/Itseez/opencv/blob/master/samples/cpp/facedetect.cpp With this modification in memory allocation: 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_; } *error glibc detected : ./facedetect free() : invalid pointer c++* I have used gprof to know the time executions of my functions here is the output of gprof ![image description](/upfiles/14367903637666746.png) I want to reduce the time spent on release and detectAndDraw functions :p NB : is manual memory management in c++ better than automatic one ?? + using delete instead of free didn't solve my problem thanks for your help :)

Viewing all articles
Browse latest Browse all 41027

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>