How to clean Virtual Memory (pagefile.sys) on each Shutdown [Windows Optimization]

Virtual memory is a file system (pagefile.sys) That Windowsul uses to store data or files that are used by the user at a time. Usually the size pagefile.sys is determined by how RAM is installed in the computer (512MB RAM, pagefile will 768MB to 1GB RAM, pagefile will 1,5GB etc.), but this can be increased or decreased for each user separately, as needed. Since pagefile.sys is an existing file hddAnd the HDD is a magnetic storage device - Unlike RAM, which is dynamic - Data stored in virtual memory remain there until they are deleted or to rewrite the above them, and these data may contain information sesibile for users, such as various passwords (Many applications have habit send information to memory without setting the encrypt, even if it can reach the pagefile from where it can be extracted under certain conditions), or due to the agglomeration of data in the pagefile.sys, at startup Windowscan occur various errors si system performance is affected. To avoid these problems, it is recommended virtual memory cleaning periodically, as often as possible.

How can we clean the pagefile.sys automatically at each Windows Shutdown

1. Using registry Editor

  • open regedit (Start-> Search-> regedit or Start-> Run-> regedit) And navigate to the path HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerMemory Management
  • entry in the right pane look ClearPageFileAtShutdown and modify the value of 0 in 1 (Right-click> Modify)


2. Using Group Policy Editor (The method is not valid for editions Windows Starter or Windows Home)

  • open Group Policy Editor (type: gpedit.msc in Run or Searchacquis in Start Menu)
  • in the left pane click on Computer Configuration->Windows Settings-> Security Settings-> Local Policies-> Security Options
  • then in the right pane, double-click on Shutdown: Clear virtual memory pagefile, select Enabled and click on OK
gpedit-pf enable

3. Using Microsoft Fixit (Download and run the executable)


Note: Enable the automatic cleaning of the virtual memory on each one Windows Shutdown increases Shutdown duration by about ~ 30 sec. tutorial tested on Windows 7 Ultimate, compatible with XP or Vista.

How to clean Virtual Memory (pagefile.sys) on each Shutdown [Windows Optimization]

About the author


Passionate about everything gadget and IT, I write with pleasure on since 2006 and I like to discover with you new things about computers and operating systems macOS, Linux, Windows, iOS and Android.

Leave a Comment