Memory leak in Image::ping()?

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Post Reply
Angus

Memory leak in Image::ping()?

Post by Angus »

I'm using the Suse rpm 6.3.0.0-27.8 for Magick++, and valgrind is reporting a memory leak, and I want to know if my code is right before making a bug report.
My code intends to simply get the dimensions of a an image file, and detect CMYK colourspace, and this is the code that does it:
Magick::Blob blob;
Magick::Image image;
try {
image.ping(sPath);
} catch (exception &ex) {
g_pLog->LogLine(ex.what());
return FALSE;
}
if (image.columns() <= 0 || image.rows() <= 0) return FALSE;
nWidth = image.columns();
nHeight = image.rows();
bCMYK = image.colorSpace() == Magick::CMYKColorspace;

That is all the Magick calls in my code. Valgrind alerts to this memory leak:
==2381== at 0x4C22AC6: malloc (in /usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==2381== by 0x5398AF8: GetCacheInfo (in /usr/lib64/libMagick.so.10.0.5)
==2381== by 0x5411567: AllocateImage (in /usr/lib64/libMagick.so.10.0.5)
==2381== by 0x1579A0DC: (within /usr/lib64/ImageMagick-6.3.0/modules-Q16/coders/jpeg.so)
==2381== by 0x53B643C: ReadImage (in /usr/lib64/libMagick.so.10.0.5)
==2381== by 0x545C07A: ReadStream (in /usr/lib64/libMagick.so.10.0.5)
==2381== by 0x53B7321: PingImage (in /usr/lib64/libMagick.so.10.0.5)
==2381== by 0x4E78317: Magick::Image::ping(std::string const&) (in /usr/lib64/libMagick++.so.10.0.5)
Is this a real bug, or is there something wrong w/my code?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Memory leak in Image::ping()?

Post by magick »

We tried your program with ImageMagick 6.3.7-3, the latest release and it returns:

==22671== definitely lost: 0 bytes in 0 blocks.
Angus

Re: Memory leak in Image::ping()?

Post by Angus »

Then I guess you aren't interested in a bug report, but my code is correct. I guess I'll have to dump the Suse RPMs and get the latest source, since this method loses a couple of kb w/each call.
Post Reply