Seeing a lot of memory leaks...

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
miles

Seeing a lot of memory leaks...

Post by miles »

Hi, :shock:

I've just built 6.5.6 using VisualStudio 8. When I link to my own programs or try eg the IMDisplay or NtMagic sample apps and run under the VS Debugger, it's all great until I exit the app in question and then I consistently get a whole heap of messages like

Detected memory leaks!
Dumping objects ->
{32306} normal block at 0x03BE0810, 8 bytes long.
Data: <P ¾ ° ¾ > 50 06 BE 03 B0 1F BE 03
..\..\magick\memory.c(204) : {13722} normal block at 0x03BD3790, 36 bytes long.
Data: < 6 ÿÿÿÿ > 88 13 36 00 FF FF FF FF 00 00 00 00 00 00 00 00
{13712} normal block at 0x03BE1FB0, 8 bytes long.
Data: <Ø ¾ È Œ > D8 1D BE 03 C8 0B 8C 02

I've looked around and can't find anything wrong. I'm new to IM, but I'm guessing this isn't right. Any ideas?

(Oh, and I set WINVER to 0x0501 and colour depth to 8 in the config).

Thanks
Miles
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Seeing a lot of memory leaks...

Post by magick »

IMDisplay and NTMagic are contributed programs that we do not maintain or support. We run a memory checker on each release of ImageMagick and verify there are no memory leaks. If you find a memory leak in ImageMagick's MagickCore, MagickWand, Magick++, or PerlMagick libraries, let us know.

ImageMagick is open-source. If you want to fix the leaks in the contributed programs, post your patches here. Thanks.
miles

Re: Seeing a lot of memory leaks...

Post by miles »

I realise that IMDisplay and NTMagic are contributed programs - I mention them because I went back and compiled them to see whether they displayed the same problems that I was seeing when I used Magick++ with my own project. And they did.

I also read elsewhere that you run a memory checker.

However, the bottom line is that I'm still seeing a huge raft of leak messages from within the magic code on termination, and we're talking about just four lines of Magick++ code.

Image image;
image.read( "giraffe.gif" );
image.crop( Geometry(100,100, 100, 100) );
image.write( "x.gif" );

So, is there some termination/garbage collection/shutdown mechanism that I've missed somewhere?

Thanks
Miles
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Seeing a lot of memory leaks...

Post by magick »

We ran your code against ImageMagick 6.5.6-1 and valgrind reports:
  • -> valgrind magick++
    ==27655== Memcheck, a memory error detector.
    ...
    ==27655==
    ==27655== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 6 from 2)
    ...
    ==27655== checked 74,209,160 bytes.
    ==27655==
    ==27655== LEAK SUMMARY:
    ==27655== definitely lost: 0 bytes in 0 blocks.
We are certainly interested if you can identify the source of a perceived leak on your platform.
Post Reply