How to Clean Up Pagefile.Sys
Windows' pagefile.sys functions as virtual memory, which allows your computer to swap information between system memory and your hard drive. Pagefile.sys doesn't need to be cleaned up to continue proper function, but it can present a security risk. Information stored in pagefile.sys can persist after rebooting your machine and may be available to knowledgeable investigators. To prevent this security breach, you can configure Windows to clear pagefile.sys when you shut down your computer. Although this heightens your security, it can also noticeably increase the shutdown time.
Hold the Windows key on your keyboard and press "R" to open the "Run" dialog box.
Type "regedit" and press "Enter." If you see a security confirmation window, click "Yes."
Navigate to "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" in the Registry Editor. Do this by double-clicking through the folders in the left pane.
Double click "ClearPageFileAtShutdown" from the right-hand pane. If you do not see this entry, right-click "Memory Management" from the left pane, point to "New" and select "DWORD (32-bit) Value." Type "ClearPageFileAtShutdown" and press "Enter" to create the entry.
Enter "0" in the "Value Data" field and click "OK."
Click the "X" at the top right of the Registry Editor to close it.
Reboot your computer twice to clear pagefile.sys. The first reboot enables the clearing function you just configured. The second reboot actually clears pagefile.sys.
Tips & Warnings
- If you later decide you do not want to clear pagefile.sys during every shutdown, change "ClearPageFileAtShutdown" back to "0" and reboot your computer.
- Always back up your registry before making any changes, as errors in the registry can have serious consequences for your computer.