How to clear the hard disk cache programmatically?

443 Views Asked by At

Is there a method in Windows to clear the whole disk cache? I am doing benchmarks on a disk and try to measure which of my methods has the best performance in C#. The problem is though that the disk caching in Windows prevents me from from getting correct results.

So the question is if there is a method to remove all cached files from the Windows disk cache?

RamMap from SysInternals is able to do it, so there must be a way, but I couldn't find how to do it.

0

There are 0 best solutions below