c++ - OpenCV - cvExtractSURF is causing a memory leak? -
i using opencv function: cvextractsurf
finding major memory leak. has implemented call?
my code follows:
iplimage *cvimage = [self createiplimagefromuiimage:image grayscale:yes]; cvmemstorage* storage = cvcreatememstorage(0); cvseq *objectkeypoints = 0; //cvseq *objectdescriptors = 0; cvsurfparams params = cvsurfparams(self.hessianthreshold, 0); double tt = (double)cvgettickcount(); //extract features cvextractsurf( cvimage, 0, &objectkeypoints, null, storage, params, 0); tt = (double)cvgettickcount() - tt; //nslog(@"%d features found in %gms seconds\n", objectkeypoints->total, tt/(cvgettickfrequency()*1000.)); cvreleaseimage(&cvimage); cvreleasememstorage(&storage);
any ideas leaking? when comment out line:
cvextractsurf( cvimage, 0, &objectkeypoints, null, storage, params, 0);
no leak occurs.
the function cvextractsurf creates list of objects of type cvsurfpoint , puts pointer in objectkeypoints. have free up.
add call...
cvrelease((void **)&objectkeypoints);
Comments
Post a Comment