开发者

Memory release problem with cvHoughLines2

I have a problem with javaCV:

CvMemStorage storage = CvMemStorage.create();

CvSeq lines = cvHoughLines2( houghInputImage, storage.getPointer(),
     cv.CV_HOUGH_PROBABILISTIC, rho, Math.PI/theta, threshold, param1, param2 );

// ...

storage.release();

This code doesn't release the memory. Used memory groving until my laptop die. If I comment out the cvHoughLines2 line then there is no problem, used memory doesn't开发者_如何转开发 groving.

Can you help me why it's happening? What do I wrong?

My environment: XP Home, OpenCV 2.1, JavaCV20100730, JRE6.


I had this problem with JavaCV as well. I am not sure where the exact problem lie, but I solved it by replacing the following line:

storage.release();

with:

cvClearMemStorage(lines.storage);

It seems to be important to release the memory from the storage object within the resulting CvSeq rather than on the one you originally passed in.

Hope this of some help!


Storage handling is working correctly in OpenCV so may be the problem can be found in JavaCV.

I assume that you call the code above in a loop. You should try to move the storage creation and release outside the loop and you may only loose memory at the end of the run.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜