Clean virtual memory on shutdown Windows 11 or 10

Stefan
Clean virtual memory on shutdown Windows 11 or 10

The page file, also known as (“page file”) or (“virtual memory”) is a hidden system file used by Windows to exchange data between RAM memory and the physical hard drive.

When your RAM is insufficient to hold any running software program or app, some of the virtual memory (including sensitive data and passwords) is moved to the page file. Even if you have enough RAM in your computer, Windows uses the page file for caching when moving or deleting a large amount of files and for other activities.

The page file is located on the system drive by default, usually at: c:pagefile.sys and is automatically created and maintained by Windows itself, but you can change it manually. You cannot see this system file directly, you must first show hidden files.

There is also a risk with the page file in Windows. The page file is well protected while Windows is running, but the data in it remains after shutdown. A malicious user who has physical access to your PC can extract sensitive data from the page file.

To avoid such a potential security risk, you can set Windows to automatically clean the page file when you shut down Windows 11 or Windows 10.

Clean virtual memory when shutting down Windows

There are two ways to do it virtual memory (“the page file”) or (“swap file”). The first way is through the Windows registry, and the second way is through the local security policy.

Clean pagefile via the Windows registry

Right-click on the start button. Click Run in the menu. In the run window type: regedit.exe.

Read also
Show desktop icons in Windows 11

On the left side open the following folder structure:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management

Double-click “ClearPageFileAtShutdown” and change the value from “0” to “1”. Click OK and close the Windows registry editor.

ClearPageFileAtShutdown

If you now shut down Windows 11 or Windows 10, the page file will be cleared.

Clean up the page file via the Local Security Policy (secpol)

Right-click on the start button. Click Run in the menu. In the run window type: secpol.msc.

Click on Local Policies on the left and then on Security Options. Then double-click the “Exit: Clear Virtual Memory Swap File” policy. Change this policy to “Enabled” and click OK. Then close the local security policy.

Clear virtual memory swap file

The paging file is now cleared by local security policy every time you shut down Windows 11 or Windows 10.

Lees meer:

Thanks to Fred. I hope this helped you. Thank you for reading.


Problem solved?


Help other people too.
Share this article on a website, forum or via social media.

Join our new computer forum for questions and computer help.
Do you have a computer question?

The email address will not be published. Required fields are marked with *