Open GoogleCodeExporter opened 9 years ago
I guess you're in luck since I have just experienced a similar memory leak
issue,
which I have now identified the cause of. It's due to a misunderstanding on the
author's part, in which he releases allocated memory in the destructors of the
classes, which is incorrect in managed C++. It should instead be deallocated in
a
the finalizer method, declared similary to the destructor, but with a '!'
instead of
the '~'.
I have not fixed all the issues, but an example is in the cvimage.h, where I
have
replaced the destructor with the following:
virtual ~CVImage()
{
this->!CVImage();
}
!CVImage()
{
Release();
}
Search the library for any remaining destructors and fix it likewise.
Original comment by kanon...@gmail.com
on 19 Oct 2007 at 12:27
kanongil, I have the same problem,your solution is not working fine even when I
disposing CVImage
here my c# code:
CVImage img;
unsafe
{
int depth = getDepth(frame.MIplImage.depth);
sbyte* b = (;sbyte*)frame.MIplImage.imageData
img = new CVImage(frame.MIplImage.width, frame.MIplImage.height,
depth, frame.MIplImage.nChannels, b);
//MessageBox.Show("done");
}
img.Dispose();
I changed the code of c++ as u told me and rebuild the project but still
leaking !
virtual ~CVImage()
{
this->!CVImage();
}
!CVImage()
{
Release();
}
Original comment by kdjd2...@gmail.com
on 21 Dec 2008 at 6:15
Original issue reported on code.google.com by
lequoct...@gmail.com
on 15 Oct 2007 at 2:29