File Read Cache - How to purge?

Neil Hodgson nyamatongwe+thunder at gmail.com
Tue Aug 21 08:52:31 EDT 2007


Signal:

> So it seems the file is being cached, however on my system only ~2MB
> of additional memory is used when the program is run. This 2MB of
> memory is released when the script exits.

    You are not measuring the memory used by the cache. This may help:
http://www.microsoft.com/technet/archive/ntwrkstn/reskit/07cache.mspx?mfr=true

> 2. Is there anyway to somehow to take advantage of this "caching" by
> initializing it without reading through the entire file first?

    The Win32 API provides FILE_FLAG_SEQUENTIAL_SCAN (don't know how 
effective this will be for your application) although its probably 
simpler to use a read-ahead thread or overlapped I/O.

> 3. If the answer to #2 is No, then is there a way to purge this
> "cache" in order to get a more accurate result in my routine?  That is
> without having to read another large file first?

http://www.microsoft.com/technet/sysinternals/FileAndDisk/CacheSet.mspx

    Neil



More information about the Python-list mailing list