- DelphiTools - https://www.delphitools.info -

Flush Windows File Cache

sweepHere is a small utility I made whose purpose is to flush (empty) the Windows file cache. It can also flush and purge memory working sets, standby and modified lists.

It can be useful to reduce memory usage of a particular VM (on a host with dynamic memory) or for testing and bench-marking purposes.

The utility was compiled with Delphi XE and comes as a simple command-line executable with just two options

You can download it here: FlushFileCache.zip [1] (13 kB)

Note that it relies on the undocumented NtSetSystemInformation function. The source code will be available on a github repository [2] as soon as I clean up the proprietary bits.

FWIW, if you have some memory-frugal service to run, it’s entirely feasible to use this utility on a Windows 2008 R2 server and stay under 128 MB RAM usage. Most of the unused OS services will be swapped out, leaving only core services in RAM.