Windows tip: How to clear the Pagefile on Shutdown
By Detector | 24 November 2008
A pagefile or swap file is a reserved portion of a hard disk that is used as an extension of random access memory (RAM) for data in RAM that hasn’t been used recently. A pagefile can be read from the hard disk. Clearing page file can be very useful if you need more space on your Hard Drive. Here is two solutions to set the computer to clear the pagefile:
Clearing page file without directly editing the registry:
- Click on the Start button
- Go to the Control Panel
- Administrative Tools
- Local Security Policy
- Local Policies
- Click on Security Options
- Right hand menu – right click on “Shutdown: Clear Virtual Memory Pagefile”
- Select “Enable”
- Reboot
Clear the page file on each shutdown (edit in registry):
- Start Regedit
- Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control
\Session Manager\Memory Management\ClearPageFileAtShutdown - Set the value to 1
Tags | Howto, Storage, Tips and Tricks, Windows
The author is confused about what this setting does. It does NOT delete the pagefile but overwrites it with zero’s. This can add considerably to restart and shutdown times. Even if the pagefile was deleted on shutdown it would be recreated on bootup with no less space used.
This setting is sometimes used as a security measure. But this really only makes sense as part of a comprehensive security policy. The risks of not doing this are very small and there are many things that are more important.
There are NO performance benefits in clearing the pagefile.
Larry Miller
Microsoft MCSA
Is there a way to empty the paging file without having to restart? It always pops that “Low on virtual memory” bubble up right when I’m in the middle of something. So, I have to stop and restart. Really annoying.
There is no way the pagefile can be cleared while Windows is running. If you receive the warning above you should increase the initial size of the page file. Set the maximum to at least twice this value. An even better idea would be to add more RAM if possible.