There have been several free tools and guides available to clear the Windows paging file (pagefile.sys). Although disabling the page file (virtual memory) is not recommended, many users disable it to save some disk space. But we don’t recommend disabling this feature as it will affect the overall system performance.
You might want to automatically clear the page file during Windows shutdown process to delete any critical data contained in the paging file. As Microsoft says, some third-party programs can temporarily store unencrypted (plain-text) passwords or other sensitive information in memory. Because of the Windows virtual memory architecture, this information can be present in the paging file.
Microsoft is providing a FixIt Solution to clear the Windows paging file at shutdown. Download, run the FixIt solution and follow the steps in the Fix it wizard to clear the virtual memory at shutdown.
One can also clear the paging file at shutdown by following these steps:
# Launch Registry Editor by entering Regedit in Start menu search area and hitting Enter.
# Navigate to the following registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management
# In the right page, double-click on ClearPageFileAtShutdown entry to change its value to 1.
# Close the Registry Editor and reboot your machine.