How to Clear the Pagefile in Windows

Share This:

clear pagefile windows

As a best practice, it is sometimes recommended that the Windows Pagefile be cleared at every shutdown or reboot. Please note that this could add a significant delay to your shutdown or reboot times as Windows basically rewrites the Pagefile with 0’s to clear it. You can either set a registry value to make a change through Group Policy to have Windows clear the Pagefile at shutdown or reboot.

Related Article: How to Set a Fixed Pagefile Size

How to Clear the Pagefile in Windows Group Policy

  • Run gpedit.msc (or run Group Policy Editor from your Domain Controller and add or edit a Group Policy)
  • Navigate to Computer Configuration > Windows Settings > Security Settings > Local Policies > Security Options on the left panel
  • In 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
  • If you set the policy from a Domain Controller, you can run gpupdate from a command prompt on a workstation/server to pull the updated policy
  • Restart your computer for the changes to take effect

To revert the changes, edit the same policy above and change the setting to Disabled, then save and reboot.

How to Clear the Pagefile in Windows Registry

  • Search and run regedit from the Start Menu
  • Navigate to the following key:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\
  • If you have a REG_DWORD key called ClearPageFileAtShutdown, double-click on it and change the value to 1
    If not, right-click and select New > DWORD (32-bit) Value and name it ClearPageFileAtShutdown and set the value to 1
  • Restart your computer for the changes to take effect

To revert the changes, edit the same registry key above and change the value to 0, then save and reboot.


Share This:

 

2 Comments

  1. Stewart Daniels April 5, 2019
    • Robert Russell April 5, 2019

Leave a Reply