2008.11.17 16:33 "Re: [Tiff] Memory leak (TIFFOpen, TIFFReadTile)?", by Bob Friesenhahn
Every modern kernel will cache file content in memory no matter what access mode is used. However, ordinary access modes don't have the pathological thrashing problem that memory-mapped access does.
Right, every OS does cache data. The degree of caching varies considerably across OSs. The main benefit of using the memory mapping is that it allows repeated data access with "zero copy". As long as the "pathological thrashing" problem (also *very* OS dependent) is not evident, repeated reads are much faster when using memory mapping. Most (>80%) of computing data access is reads.
My application defaults to using programmed I/O. The reason for this is that I found that read-ahead algorithms often work much better with programmed I/O if the file is accessed over a network. Few operating systems are willing to speculatively read more than 8, 16, or 32K ahead when the file is accessed over a network. With programmed I/O a a larger read size can be requested so the OS feels safe about its use of the network. Some operating systems do not perform read ahead at all when memory mapping is used, and so each page fault (a page might be as small as 4K) results in the addition of network access latency and therefore substantially reduced read performance.
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/