How do you clear the Page Cache, other than rebooting.
What if you read and write CR3:
mov eax, CR3
mov CR3, eax
Thanks Stan, but that didn't do it. I'm timing how long it takes to read a large group of files using different code and I don't want to have to keep rebooting between tests. I was hoping there was an easy way, such as you offered, but since it's only for a test I can live with the reboots.
Try setting the Virtual Memory to the minimum 2 MB (for XP),
if you have a good amount of RAM (ie 512 MB), XP wont use
the virtual memory unless absolutely needed.
You could also use a RAMDisk to hold the files or even
the Virtual Memory page file.
Quote from: Mr Earl on January 03, 2007, 11:04:42 PM
Thanks Stan, but that didn't do it. I'm timing how long it takes to read a large group of files using different code and I don't want to have to keep rebooting between tests. I was hoping there was an easy way, such as you offered, but since it's only for a test I can live with the reboots.
Actually Stan was correct. It's a privileged instruction under Windows, so you have to do it in a driver. Also keep in mind when you do that it has to clear the entire TLB cache which may take time. A similar instruction for clearing the L1/L2 caches is wbinvd. And it's really slow, but it has to clear a lot more cache.
Mark
Something I remember in the win9x days was the problems of effective memory loss due to fragmentation but it was a reasonable simple problem to solve. I simply allocated just over all of the ram I had on the machine, then deallocated it all and suddenly the machine had all of its memory available again. Back in those days it saved a reboot as the memory fragmentation got worse.