c++ - cvHoughLines2 memory leak -


does opencv method houghlines2 has memory leak that's not been fixed since (version 2.1.0.6), or there's wrong part of code ?

cvmemstorage *storage = cvcreatememstorage(0); cvseq *linesseq = 0; double smalll = 0.0, bigl=0.0, smalla = 0.0, biga = 0.0; linesseq = cvhoughlines2(cannyimg, storage, cv_hough_probabilistic, 1, cv_pi/180.0, 30, 50, 15); for( int = 0;i < linesseq->total; i++ ){     cvpoint* line = (cvpoint*)cvgetseqelem(linesseq,i);     double sz = sqrt((line[0].x- line[1].x) *(line[0].x- line[1].x) + (line[0].y -line[1].y)*(line[0].y-line[1].y));     if(sz < 70.0 ) smalll+=1.0;     else bigl +=1.0;      double deltay = line[1].y - line[0].y;     double deltax = line[1].x - line[0].x;     double angle;     if ( abs(deltax) > 1e-7){         angle = atan2(deltay, deltax);          if (angle < 0.1) smalla+=1.0;         else biga+=1.0;     }else{      }  }  cvclearmemstorage(storage); cvclearseq(linesseq); cvreleaseimage(&cannyimg); 

thank you

you using cvclearmemstorage. not deallocate memory, resets pointers. if want release memory, should use cvreleasememstorage(&storage) (and wouldn't need cvclearseq anymore, way, since deallocate memory).


Comments