2007.05.15 21:01 "[Tiff] Memory leak opening and closing files?", by Zak Frentz

Hi, I'm using libtiff v. 3.8.2 compiled with gcc on a Mac G5 with OS X 10.4.9. I am trying to open, and read several thousand 16-bit grayscale TIFFs, in a serial fashion. I noticed that memory was quickly decreasing as I did this, at the rate of about 10Mb per second! I tried just TIFFOpen and TIFFClose on each file in the list, and still the free memory decreases, though about 10x slower. Here is some code:

    TIFF *img;
    for (i = 0; i < n_files; i++) {
       img = TIFFOpen(file_names[i], "r");
       if (img != NULL)
          TIFFClose(img);
       else {
          fprintf(stderr, "Could not open file %s\n", file_names[i]);
          break;
       }
    }

Any ideas on solving this problem? Thanks!

Zak