Is there a way to reset Windows file cache?

9

3

When an application reads a file from a media, the first time the timing is significant as the file is indeed read, sometimes several minutes. But with subsequent reads, it only takes a few seconds and there is no disk activity. I assume it's because Windows keeps the read file in memory.

Is there a way to tell Windows to drop the cache for a file and force it to read it again from the media?

Obvious workarounds is to disconnect ad reconnect a drive (if it's external) or restart Windows. Are there any simpler options?

somebody

Posted 2012-04-26T09:42:53.530

Reputation: 93

possible duplicate of How to clear Windows File Cache

– Bob – 2012-04-26T09:53:48.633

There's also the StackOverflow related question: Clear file cache to repeat performance testing, and from a programming perspective there's a MSDN article with some Windows API flags: File Caching

– Bob – 2012-04-26T09:56:20.410

@Bob: I saw it but it was a different question. – somebody – 2012-04-26T10:07:16.387

It would seem this is not possible after all... – somebody – 2012-04-26T10:09:39.813

What version of Windows? – David Schwartz – 2012-04-26T11:29:15.680

Windows Server 2008 R2. – somebody – 2012-04-26T11:43:49.270

Answers

9

Legendary programmer Mark Russinovich has created a large number of tools that must be in every Windows administrator's and developer's tool kit. One of those tools is RAMMap. On Vista and later (and 2008R2 is later), RAMMap will allow you to free selected memory pools.

The option you want is Empty -> Empty Standby List -- cached pages that are clean and thus eligible to be freed will be in the Standby List. Note that you won't see anything happen in the RAMMap display because it doesn't auto-refresh. You can hit F5 to refresh the display or watch in Task Manager or another tool.

David Schwartz

Posted 2012-04-26T09:42:53.530

Reputation: 58 310

1That actually worked! I love the tool. Thank you very much. :) – somebody – 2012-04-26T13:13:57.787

1It did work for me on 2008 R2 with a USB HDD. – somebody – 2012-04-26T13:14:24.840

Is there a way to automatically/regularly empty the standby list? Windows 7 keeps filling it back up annoyingly, and I need to keep it empty, but I don't want to have to visually monitor the standby memory with resource monitor and then manually use RAMMap's empty standby list option. – Kirk Boyer – 2012-11-30T08:22:11.740

It's painful. The method is: 1) Allocate about as much memory as there is memory on the standby list. 2) Dirty all that memory. 3) Free it. – David Schwartz – 2012-11-30T10:27:00.523

The option you want is Empty -> Empty Standby List -- cached pages that are clean and thus eligible to be freed will be in the Standby List. Sounds promising, but what does this have to do with the drive-read cache? How would one know that menu applies to disk caches? – Synetech – 2013-12-01T00:45:21.737

Operating systems haven't had disk caches for a decade or so. Modern operating systems have unified page caches instead. – David Schwartz – 2014-01-28T23:10:04.983

-2

Yes, there's a program that can collapse the file cache automatically every say 5, 10 or any other user defined amount of minutes. The main purpose of the program is reducing memory usage of programs & processes but it also can automatically flush/collapse the file cache. The program is called CLEANMEM and offers the user a very easy way of both automatically & manually collapsing the file cache.

Willy2

Posted 2012-04-26T09:42:53.530

Reputation: 17

1If you're going to post an answer, post an answer. – Excellll – 2014-05-04T17:51:52.197

OK. The program I am referring to is CLEANMEM. – Willy2 – 2014-05-04T22:00:16.147