Memory leak in Image with x:root

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
chris1234
Posts: 1
Joined: 2012-03-06T14:25:58-07:00
Authentication code: 8675308

Memory leak in Image with x:root

Post by chris1234 »

Hi,
I'm getting a memory leak when capturing from my x desktop.
A simple example is

Code: Select all

#include <Magick++.h>

int main(int argc, char *argv[])
{
    Magick::Image img("x:root");
    return 0;
}
The output from valgrind is:

Code: Select all

==16722== 39,780 (38,712 direct, 1,068 indirect) bytes in 3 blocks are definitely lost in loss record 80 of 82
==16722==    at 0x4027199: memalign (vg_replace_malloc.c:581)
==16722==    by 0x40271F6: posix_memalign (vg_replace_malloc.c:709)
==16722==    by 0x454F21C: AcquireAlignedMemory (in /usr/lib/libMagickCore.so.3.0.0)
==16722==    by 0x45409F5: AcquireImage (in /usr/lib/libMagickCore.so.3.0.0)
==16722==    by 0x45F2435: ??? (in /usr/lib/libMagickCore.so.3.0.0)
==16722==    by 0x4607160: XImportImage (in /usr/lib/libMagickCore.so.3.0.0)
I'm running Ubuntu 11.10 with has magick++ 6.6.04 by default.
I've also built 6.7.5.10 and get the same problem. For this version valgrind reports:

Code: Select all

==29939== 65,388 (38,736 direct, 26,652 indirect) bytes in 3 blocks are definitely lost in loss record 1,341 of 1,342
==29939==    at 0x4028876: malloc (vg_replace_malloc.c:236)
==29939==    by 0x46987C5: AcquireMagickMemory (memory.c:398)
==29939==    by 0x46873BD: AcquireImage (image.c:160)
==29939==    by 0x4753BE0: XGetWindowImage (xwindow.c:4315)
==29939==    by 0x4768AE0: XImportImage (xwindow.c:5033)
Any ideas?

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

Re: Memory leak in Image with x:root

Post by magick »

Thanks for the bug report. Look for a patch in ImageMagick 6.7.6-0 Beta that plugs the memory leak by sometime tomorrow.
Post Reply