Disable or clear page cache in Windows

I assume that Windows has a similar concept for the Linux page cache for storing in-memory data from disks such as files, executables, and dynamic libraries. I wonder if it is possible to disable such a cache at all, or at least clear / flush it.

+6
windows caching disk
Mar 26 '14 at 15:39
source share
1 answer

This is called the Standby List under the windows. You can flush it globally, either for a single volume or for a single file descriptor.

Globally
You can do this using an easily accessible program from Microsoft Technet by choosing EmptyEmpty Standby List

Programmatically, you can achieve the same by using the undocumented function NtSetSystemInformation , for details, see line 239 in a program that performs, among other things, as mentioned earlier.

For one file descriptor
Open the file with FILE_FLAG_NO_BUFFERING . The documentation lies to the extent that it says that you open the file without buffering, but the true, observed behavior in all versions of Windows from Windows 98 to Windows 8 is that it simply discards the full cache contents for this file (for everyone! ) and does not overwrite the cache from reading using this descriptor.

For one full volume
A volume descriptor is just a file descriptor (somewhat special, but still), so assuming you have the appropriate privileges to open a volume descriptor, you can do the same for a full volume.

Also, as pointed out by Mehrdad, the answer here seems to be a function / error (function-error?) That allows you to invalidate cache volumes even without proper privileges, simply by opening it without shared records, at least under one last Windows version.
Obviously, this happens when any open that is writable is successful, since you can change the internal data of the file system (if it is a function), but it also seems to work when the volume fails (which is an error) .

+11
Apr 15 '14 at 13:23
source share



All Articles