2006.06.14 09:08 "Re: [Tiff] Editing a tiff image using libtiff", by Gerben Vos
If ever a TIFF with memory-management data were to be designed, the data better accompanies each data block.
The easiest way is of course to make a single-linked list: put a pointer to the first free memory block in bytes 8-11. Every free memory block then contains a pointer to the next block in bytes 0-3 of the block, and its own length in bytes 4-7. End of list is indicated by a zero pointer. Blocks of less than 8 bytes can't be linked and are lost. In BigTiff, the pointers and lengths would become 8 bytes, and the minimum reclaimable block size 16 bytes.
Two problems: how to indicate the fact that we have a free block list (a magic number in bytes 12-15?), and non-free-block-list-aware programs that edit a TIFF will destroy it, so implementations using the list should be extremely robust (at the very least, check for pointers outside the file, and that you're not overwriting IFDs). The second problem probably makes this idea too complicated to implement; it may be easier for applications/libraries to just calculate the free spaces from the IFDs.
Sorry, just thinking aloud... :-)