2005.05.12 22:27 "[Tiff] Array of open TIFFs limited to 2045?", by S Smith

2005.05.12 23:14 "Re: [Tiff] Array of open TIFFs limited to 2045?", by Frank Warmerdam

I have a continuous acquisition loop going and I want to save time by opening all the TIFF files beforehand and then closing them all at the end of the epoch. But there seems to be a limit of 2045 files (variable 'numfiles' below). Libtiff crashes if I exceed that number of files. Why? Is there a way around it?

TIFF** tifarray;
tifarray = (TIFF**)malloc(sizeof(TIFF*)*numfiles);
for (int prei=0;prei<m_NumFiles;prei++) {
        filename_suffix.Format("%06d.tif",prei);
        output_filename = m_FilenameBase + filename_suffix;
        tif = TIFFOpen(output_filename, "w");
        TIFFSetField(tif, TIFFTAG_PLANARCONFIG,

S. Smith,

As Chris mentions, I strongly suspect you have hit the "open file limit" on your operating system. You mention that libtiff crashes. I suspect that is because TIFFOpen() returns NULL when the open fails, but you pass this NULL pointer into TIFFSetField(). I would strongly encourage you to do a bit of error checking.

Best regards,

---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent