b11_ said:
Under Wxp, when you quit an application, the file cache is flushed (file
cache size drops dramaticly and unnesssarily).
That's not true. What you are calling 'file cache size' is the file
cache's working set.
The working set is the memory that has been recently used so Windows
expects that it is used again in the near future. Every process has
a working set and the file cache has too. A process's working set
is shown by the taskman in the process list as 'Mem usage' which is
misleading. Vista's taskman uses the true name: 'Working Set'.
The working set of a process is trimmed when its main window is
minimized. You can watch this in the taskman.
Trimming the working set doesn't mean that the memory is taken away from
its owner. It only means that the Windows memory management thinks that
it's not important to hold it in physical RAM. Applications memory
might be swapped out to the pagefile, file cache's memory might be
discarded. As long as the memory owned by the file cache is not required
for something else it's still availlable and its content valid. Read
accesses will still come out of the file cache.
Here is my simple test tool:
http://www.uwe-sieber.de/files/filecachetest.zip
Check 'FILE_FLAG_RANDOM_ACCESS'. This flag makes Windows blow up the
file caches working set. Then click 'Write'. In the perfmon you can
seen the 'Cache Bytes' growing. When you click 'Close' Windows takes
the cache memory for this file out of the cache's working set. You
can seen the 'Cache Bytes' go down. When you click 'read' you will
see that the file is read lightning fast (some hundred MB/s) even
the cache's working set had been trimmed before. The cache's content
surived the trimming...
How can one stop the file
cache flushing that occurs after one quits an application?
What it is effect you have a problem with this apart from some numbers
shown in the taskman or perfmon?
Uwe