Page 1 of 1

Static linking memory leaks

Posted: 2017-03-23T08:25:13-07:00
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.

Re: Static linking memory leaks

Posted: 2017-03-23T17:30:37-07:00
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.