Memory Leak in semaphore.c
"Alan Wright" <[email protected]> Mon, 8 Dec 2008 14:37:15 -0000
| Newsgroups | gmane.comp.video.image-magick.bugs |
|---|---|
| Message-ID | <20F6152D0F2B4B78A8B3D682F5786CD6@AlanPC> |
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.