How to Clear the Pagefile at shutdown on Windows 10/11

Pagefile, also known as swap file, is a system file in Windows that acts as a virtual memory extension of the computer's physical memory (RAM).

Share

Your computer has two types of memory, RAM (Random access memory) also known as physical memory and Virtual memory, also known as the Pagefile.sys uses part of your hard drive to effectively expand your RAM, allowing you to run more programs than it could otherwise handle. In a nutshell, when physical memory (RAM) is not enough to fit all the running programs, Windows automatically move some load to Virtual memory. Those files are saved on your local hard drive as Pagefile.sys & they are managed by Windows itself.

Pagefile.sys is a file created and used by Windows to manage memory usage. It’s located at C:\pagefile.sys by default, but you won’t see it unless you tell Windows Explorer not to hide protected operating system files.

  1. Open file explorer using Windows + I keyboard shortcut,
  2. Click on file then change folder and search options,
  3. Now, On the View tab, uncheck “Hide protected operating system files (Recommended).”
  4. Go to local disk C. You should easily see the pagefile.sys.

Hide protected operating system files

Advantages of Virtual Memory:

- Advertisement -
  • It allows more applications to be run at the same time.
  • It allows larger applications to run in systems that do not have enough physical RAM alone to run them.
  • Provides a way to increase memory which is less costly than buying more RAM.
  • Provides a way to increase memory in a system that has the maximum amount of RAM that its hardware and operating system can support.

Disadvantages of Virtual Memory: 

  • It does not offer the same performance as RAM.
  • It can negatively affect the overall performance of a system.
  • Takes up storage space that could otherwise be used for long-term data storage.

Can I remove pagefile.sys?

The answer is yes, but you can’t delete this normally by right click and delete. Pagefile.sys is a file created and used by Windows to manage memory usage And needs to perform some special steps if you want to remove it. Here in this post We’ll be discussing two methods to get rid of the paging file in your Windows 10, 8.1 and 7. or you can set it to Windows Pagefile be cleared at every shutdown or reboot.

Note: This could add a significant delay to your shutdown or reboot times as Windows basically rewrites the Pagefile with 0’s to clear it.

Clear Pagefile.sys in Windows 10

  • Open Control Panel and search for ‘advanced system settings
  • Click Settings within the Performance section, which is on the Advanced tab.
  • Now again, choose the Advanced tab in the window that opens and click the ‘Change…’ button under Virtual memory.
  • Here uncheck “Automatically manage paging file size for all drivers” and set the option “No paging file.”
  • You can also change the size of the file, specifying on your own.
  • In the end, click “Apply” and “OK” and restart your PC.
  • The pagefile.sys files should disappear from your hard drive.

Remove pagefile on windows 10

Clear Pagefile at Shutdown in Windows 10

Also, you can tweak the Windows registry or apply group policy to set Windows clear page file at every shutdown or restart.

Using Windows registry editor

  • 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

ClearPageFile at Shutdown

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

using group policy editor:

Note: Windows 10 Home basic edition don’t have group policy feature, for this reason, steps below are applicable to Windows 10 pro and enterprise users only.

  • 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
  • Restart your computer for the changes to take effect

Clear pagefile sys using Windows Group Policy

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

Also read:

Steve Ballmer
Steve Ballmer
With over 7 years of experience in the IT industry, I have experience in IT support, helpdesk, sysadmin, network admin, and cloud computing. Certified in Microsoft Technologies (MCTS and MCSA) and also Cisco Certified Professional in Routing and Switching.

Popular posts

NordVPN Birthday Deal

2-Year plan: 67% off + 3 Months FREE

30-day money-back guarantee