2011.04.20 10:57 "[Tiff] Memory allocation in TIFFWriteBufferSetup", by Guillaume Muller
I recently upgraded from a very old version (3.4) of the library to the latest one (3.9.5). There is an important modification in the way memory is allocated, in writing mode: now the buffer tif_rawdata is allocated for a whole strip, whereas previously it was allocated just for one line.
This change has been implemented in 3.7.0 alpha. I've browsed a little bit the changelog, but couldn't find something really relevant. There is a commit named "Fixed reporting size of the buffer in case of stripped image in TIFFWriteBufferSetup()", but I'm not sure it's the same thing.
The problem I have is that my application is generating huge files (between 1 and 2Gb), and with one single strip.. this is required for compatibility with the reader software. And of couse the extra memory allocation (1Gb compared to a few kilobytes) is hardly manageable. Actually my application doesn't work anymore since it generates multiple files in parallel.
So my question: does someone remember the reason of this change?
I've tried to revert to the old allocation, and at first glance it seems to work: with or with compression, writing single lines or whole strips, it works. Apparently all the encode methods take care of calling TIFFFlushData() when needed. But I'm wondering if it's really safe.
Any input will be highly appreciated,