[gdal-dev] FlushFileBuffers in PNG and JPEG drivers

Ben Harper ben at imqs.co.za
Wed Nov 25 02:33:24 EST 2009

I've noticed that the PNG and JPEG drivers in GDAL call theVSIFFlushL function when finished writing a file. On Win32, this winds up at FlushFileBuffers. Now, unless you're doing something transactional, or using memory mapped files, or something of that nature, FlushFileBuffers is simply not necessary, but it does have the penalty of forcing the disk to seek and write. I noticed this when using GDAL to produce and cache map tiles to PNG and JPEG files - you end up with a nasty serialization. I don't believe the TIF driver does this, nor the BMP, but I haven't investigated others.
I can't see why exactly this call exists, but I'm pretty sure they can be safely removed for the PNG and JPEG drivers, without any loss of correctness. I'm not submitting a patch, because this change is so trivial. And maybe there is some reason these things exist?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20091125/99495f12/attachment-0001.html

More information about the gdal-dev mailing list