2006.02.13 16:05 "Re: [Tiff] Memory leak in TIFFOpen on Win32 ?", by Bob Friesenhahn
There are two different I/O subsystems which work in the Windows build. Besides the tif_win32 module, the tif_unix module may be used under Windows. The leak may be I/O subsystem related so it is particular to the Windows platform. Which one of these does the GnuWin32 libtiff use?
tif_win32=libtiff/tif_win32.c
tif_unix=libtiff/tif_unix.c
Bob
Just try the following code:
#include <stdio.h>
#include <tiffio.h>int main(int argc, char *argv[])
{
int i;for (i = 10; i > 0; i --)
{
printf("Starting in %d ...\r", i); fflush(stdout);
sleep(1);
}for (i = 0; i < 10000; i ++)
{
TIFF * in = TIFFOpen("cyan.tif", "r");
if (in) TIFFClose(in);
}
sleep(20);
return 0;
}What I notice is that memory usage increased without going down at any moment. I'm using GnuWin32 v3.8.0 self-installer package on Windows 2000, and compiled this test with MinGW. The test file can be downloaded from http://216.113.38.184/download/cyan.tif (3.9M). This is a 10800x13200 8bits monochrome tiled TIFF file, compressed with deflate method and which was generated by libTIFF itself (v3.7.3).
I also run this test on Linux and Mac OS X, with sources downloaded from ftp, and have not seen any problem.
Does someone else notice that strange side effect?
--
Thierry Pierron
Polkadots Software Inc.
2501 Dollard
Lasalle, QC
H8N 1S2 Canada
======================================
Bob Friesenhahn
bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/