Page 1 of 1
Magick++ memory leak
Posted: 2007-02-04T09:54:24-07:00
by jolz
There's a memory leak in exception handling.
readImages() calls GetExceptionInfo() and doesn't call DestroyExceptionInfo(), because of throw (looks like a great place for RAII)
Actually resources are released in throwException(), but then they are again acquired in the same function.
By the way, I find throwing warning very inconvenient - I have to catch warning after every call if I want to ignore it or just log - it makes C++ almost like C.
Re: Magick++ memory leak
Posted: 2008-03-25T07:00:27-07:00
by zeugman
I've the same problem.
On valgrind blocks are definitively lost here :
==9455== by 0x51986E1: GetExceptionInfo (exception.c:415)
==9455== by 0x4E53525: Magick::Image::read(Magick::Blob const&) (Image.cpp:1448)
and here
==9455== by 0x4E4B3EE: Magick::throwException(MagickLib::_ExceptionInfo&) (Exception.cpp:297)
==9455== by 0x4E5356A: Magick::Image::read(Magick::Blob const&) (Image.cpp:1454)
Re: Magick++ memory leak
Posted: 2008-03-25T08:39:05-07:00
by magick
Can you post a very short program we can use to reproduce the problem you posted. If we can reproduce it we will have a patch for the problem within a day or two.
Re: Magick++ memory leak
Posted: 2008-03-25T09:29:06-07:00
by zeugman
Code: Select all
#include <Magick++.h>
#include <string>
#include <iostream>
#include <fstream>
using namespace std;
using namespace Magick;
int main(){
string test = "sdfisjfjspefosepf";
Blob blob(test.c_str(),test.size());
Image image;
try
{
image.read( blob );
}
catch( Exception &error_ )
{
cout << "Caught exception: " << error_.what() << endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
Re: Magick++ memory leak
Posted: 2008-03-25T09:32:07-07:00
by magick
We have a patch in ImageMagick 6.4.0-1 Beta to fix the problem you reported. The patch is available now in subversion or it is available in
ftp://magick.imagemagick.org/pub/ImageMagick/beta within a few hours. Thanks.
Re: Magick++ memory leak
Posted: 2008-04-08T04:50:13-07:00
by zeugman
It works fine thanks