The Pagefile is one of the oldest and most important features in Windows. It acts as a virtual memory on your Windows system. Whenever your machine is low on memory, Windows moves the least used memory pages to a hidden file called pagefile. By default, the pagefile is automatically created and maintained by Windows itself. This enables Windows to run programs as it should without crashing them due to low memory. Even if you have plenty of memory, Windows still uses the pagefile for caching when moving or deleting a large amount of files and for other activities.
As most of you know, whenever you shut down your system, the contents of the memory (RAM) are automatically lost due to the loss of power. But when it comes to the pagefile, the content stays intact unless Windows removes them. This makes it possible for others to probe for data in the pagefile. If you don’t want this to happen, you can force Windows to automatically clear the pagefile every time you shut down Windows.
Related: How to change the pagefile’s size and location in Windows.
How Windows Clears the Pagefile
When you make Windows automatically clear the pagefile with every shutdown, it will actually overwrite the existing pagefile data with “zeros.” This makes it near impossible to recover data from the pagefile. However, because of the rewriting process, the time to shut down your system may increase.
Using Windows Group Policy Editor
If you are using the Pro or Enterprise version of Windows, then you can use the Group Policy Editor to clear the pagefile automatically. To start, search for gpedit.msc in the Start menu and open it.
The above action will open the Group Policy Editor. Here, navigate to “Computer Configuration -> Windows Settings -> Security Settings -> Local Policies -> Security Options” on the left panel.
On the right panel, find and double-click on the “Shutdown: Clear virtual memory page file” policy.
In the policy settings window, select the “Enabled” radio option, and then click on the “OK” button to save the changes.
Then just restart your system to make the changes take effect and you are good to go. If you ever want to revert back, simply select the “Disabled” radio option in the policy settings window.
Using Windows Registry Editor
If you are using the Home version of Windows, then you have no choice but to use the Windows Registry to clear the pagefile. To do that, search for regedit in the Start menu and open it.
Once the Registry Editor has been opened, navigate to the following key on the left pane: