keke77 / javacv

Automatically exported from code.google.com/p/javacv
GNU General Public License v2.0
0 stars 0 forks source link

JavaCV - memory leak #401

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi, i'm with a problem that the memory leak fast when execute this for in a 
loop infinite

        for (Vaga vaga : vector) {
            IplImage tempRoi = cvCloneImage(mImgA);
            cvSetImageROI(tempRoi, vaga.getRegion());
            vaga.setImg(tempRoi);
        }

the function setImg(img) is a normal attribution like
this.mImg = img;

if I use cvReleaseImage(tempRoi) at the end of for, I cant use vaga.getImg() 
later.

How can I solve my problem of memory leak and use the getImg() later?

Original issue reported on code.google.com by douglasf...@gmail.com on 26 Dec 2013 at 5:34

GoogleCodeExporter commented 9 years ago
The memory leak is with cvCloneImage(). Call mImgA.clone() instead, and that 
will take care of memory management issues with the garbage collector.

Please ask your questions on the mailing list next time if possible, thank you!

Original comment by samuel.a...@gmail.com on 27 Dec 2013 at 1:20

GoogleCodeExporter commented 9 years ago
well, thanks, it help me a lot
sorry, it was my first time here, thanks again

Original comment by douglasf...@gmail.com on 27 Dec 2013 at 2:55