I'm trying to use the ImageMagick API to generate an image from text, which will be used elsewhere. However when I use the function MagickAnnotateImage() my Visual Studio tells me about memory leaks when exiting the application. They look as follows:
Code: Select all
..\..\ImageMagick\magick\memory.c(169) : {113809} normal block at 0x07F0ABF0, 9 bytes long.
Data: <Webdings > 57 65 62 64 69 6E 67 73 00
..\..\ImageMagick\magick\memory.c(169) : {113800} normal block at 0x07F0A900, 20 bytes long.
Data: <Verdana-Bold-Ita> 56 65 72 64 61 6E 61 2D 42 6F 6C 64 2D 49 74 61
..\..\ImageMagick\magick\memory.c(169) : {113791} normal block at 0x07F0A600, 13 bytes long.
Data: <Verdana-Bold > 56 65 72 64 61 6E 61 2D 42 6F 6C 64 00
I built ImageMagick from source using version 6.9.1-10 and the configuration with the /MD flag and a Quantum depth of 8. I'm inlcuding the sources in my project and linking against the generated lib files. My system is Windows 7, 32 bit with Visual Studio 2010. As in the VisualMagick projects the default calling convention is set to __cdecl if that matters somehow.
This is the excerpt of my code that uses the ImageMagick API:
Code: Select all
...
MagickWandGenesis();
MagickBooleanType success;
CString text = "Hell World";
MagickWand* textImage = NewMagickWand();
PixelWand* pixels = NewPixelWand();
PixelSetColor(pixels, "red");
DrawingWand* drawing = NewDrawingWand();
DrawSetFontSize(drawing, 15);
DrawSetGravity(drawing, CenterGravity);
success = MagickNewImage(textImage, 200, 100, pixels);
success = MagickAnnotateImage(textImage, drawing, 0, 0, 0, text.GetString());
success = MagickWriteImage(textImage, "D:\\output.png");
// clean up
DestroyPixelWand(pixels);
DestroyDrawingWand(drawing);
DestroyMagickWand(textImage);
MagickWandTerminus();
...
Is there anything I am missing? The API itself works really great and is just what I need, but I don't want to use it, if I end up with all those leaks.
Thanks in advance for any help.