[Magick-bugs] Memory Leak in semaphore.c
Alan Wright
alanwright.atex at googlemail.com
Mon Dec 8 06:37:15 PST 2008
Hi,
I'm getting a memory leak that I've tracked down to semaphore.c, AllocateSemaphoreInfo():
semaphore_info=(SemaphoreInfo *) malloc(sizeof(SemaphoreInfo));
I also have a report of a memory leak in memory.c, AcquireMagickMemory():
memory=memory_methods.acquire_memory_handler(size == 0 ? 1UL : size);
Initially, these were detected via the VS CRT during debug, however not trusting this completely (since I know there's some clean up performed in DestroyMagick() that _CrtDumpMemoryLeaks can miss ), I compiled a version of IMDisplay that continually loads and saves a small PNG image. I could see the memory increasing steadily when left over a period of 2 hrs - 18 mb it grew to and was still growing when I killed the process.
To see this for yourself, simply add the following to CIMDisplayDoc::DoReadImage():
for ( ;; )
{
m_pImage.read(m_szFile.GetBuffer(MAX_PATH+1));
m_pImage.write( "c:\\testleak.png" );
}
If it helps I can send you the image I'm using to test this, but it leaks no matter what format you use.
(ImageMagick 6.4.7-3, Visual Studio 2007, Windows Vista)
Many thanks for your time,
Alan.
More information about the Magick-bugs
mailing list