Static linking memory leaks

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
gringo974
Posts: 16
Joined: 2016-10-04T07:07:21-07:00
Authentication code: 1151

Static linking memory leaks

Post by gringo974 »

my IM build is 7.0.5-3, multi-threaded DLL (MTD) static lib.
my OS is windows 8.1
my IDE is MS visual studio 2015.

I noticed some memory leaks on my program that uses Magick++ api, when I tried to link statically.
I use _CrtDumpMemoryLeaks to report memory leaks.

I managed to reproduce it on the UTIL_convert project:
Just add the _CrtDumpMemoryLeaks() call just before exit the main function in utilities/magick.c.

I tracked the memory allocation numbers and it seems to be glib allocations.

Maybe this is just false positives reports because glib release its memory block at the exit time?
Could you please confirm?

When I link the magick lib dynamically, I have no memory leak report.

Thanks in advance.
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Static linking memory leaks

Post by dlemstra »

It is indeed a false positive because those glib allocations will be released when your program exits. I tried to find a way to release them but I could not find an API call for that, I did this a while back so I don't know the details anymore.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
Post Reply