News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Clear Page Cache

Started by Mr Earl, January 03, 2007, 10:09:26 AM

Previous topic - Next topic

Mr Earl

How do you clear the Page Cache, other than rebooting.

stanhebben

What if you read and write CR3:


mov eax, CR3
mov CR3, eax


Mr Earl

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.

dsouza123

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.

Mark_Larson

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
BIOS programmers do it fastest, hehe.  ;)

My Optimization webpage
htttp://www.website.masmforum.com/mark/index.htm

hutch--

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.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php