Clear Virtual Memory Page File on Windows 8
In this article
To clear the virtual memory page file on Windows 8, you must disable it in System Properties, restart, then re-enable it (or delete the file manually). This is not a routine maintenance task; the page file is managed automatically by Windows and clearing it only helps in specific situations like freeing disk space or troubleshooting a corrupted hibernation file.
What Is the Page File and Why Does It Exist?
Windows uses a file on your hard drive called pagefile.sys as an extension of physical RAM. When memory pressure is high, the operating system moves less-used data from RAM to this file, freeing physical memory for active processes. This is called virtual memory. The page file is always in use, even when you have plenty of RAM, because Windows may pre-emptively move some data. Deleting it while the system is running would cause instability, which is why you cannot simply right-click and delete it.
Why Would You Want to Clear It?
There are a few legitimate reasons to clear or reset the page file:
- Free up disk space – The page file can be as large as your RAM or more, so on a small SSD it can consume several gigabytes.
- Fix a corrupted page file – If you get errors like “The paging file is too small” or system crashes, resetting it can help.
- Remove sensitive data – The page file can contain fragments of documents or passwords. Clearing it on a machine you are about to sell or dispose of is a security measure.
- Change its size or location – You might want to move it to another drive or set a fixed size.
How to Clear the Page File in Windows 8 (Step-by-Step)
Follow these steps to disable and then re-enable the page file:
- Open System Properties: Press Win + Pause/Break, or right-click This PC and select Properties.
- Click Advanced system settings on the left.
- Under the Advanced tab, in the Performance section, click Settings.
- Go to the Advanced tab and click Change under Virtual memory.
- Uncheck Automatically manage paging file size for all drives.
- Select the drive that contains the page file (usually C:), choose No paging file, and click Set.
- Click OK and restart your computer. Windows will delete the old page file during shutdown.
- After restart, repeat steps 1–4, select the drive again, choose System managed size (recommended) or a custom size, click Set, then OK and restart again.
After the second restart, a fresh page file is created. If you only wanted to clear it temporarily, you can leave it disabled, but that may cause instability if your RAM is limited.
Alternative: Delete the Page File Manually (Advanced)
If you cannot restart immediately or want to delete the file without re-enabling, you can use the command line:
- Open an elevated Command Prompt (right-click Command Prompt and choose Run as administrator).
- Type
wmic pagefile list /format:listto see the current location. - To disable the page file, use
wmic pagefileset where name="C:\\pagefile.sys" delete(adjust the path if needed). - Restart. The file will be removed.
This method is riskier and not recommended for most users because it bypasses the graphical interface and can leave the system in an inconsistent state if done incorrectly.
Common Mistakes and Misconceptions
Mistake: Clearing the page file improves performance. Actually, the opposite is true. A page file that is too small or absent can cause out-of-memory errors and slowdowns. Windows manages it efficiently; clearing it regularly provides no benefit.
Mistake: You can just delete pagefile.sys in File Explorer. The file is protected by the operating system. Even if you take ownership and delete it, Windows will recreate it at boot. The only reliable way is to disable it via System Properties.
Misconception: The page file is only used when RAM is full. Windows may use it for other purposes, such as kernel crash dumps or pre-fetching, even with plenty of RAM.
When Should You NOT Clear It?
Do not clear the page file if:
- You have less than 4 GB of RAM – the system may become unstable.
- You are troubleshooting a crash – you might lose the dump file that helps diagnose the issue.
- You are not experiencing any problems – it is unnecessary and risky.
If your goal is simply to free disk space, consider using the Disk Cleanup tool or moving the page file to another drive instead of disabling it entirely.
Frequently Asked Questions
Will clearing the page file erase my files?
No. The page file contains only temporary data that Windows uses for memory management. Your personal files, documents, and installed programs are unaffected. However, you will lose any unsaved work in open programs because the system restarts.
How big should the page file be?
For most users, the default “System managed size” is best. It grows and shrinks as needed. If you want a fixed size, a common recommendation is 1.5 times your RAM, but this is not a rule. For example, with 8 GB RAM, a 12 GB page file is typical, but you can set it to 8 GB or even 4 GB if you have plenty of RAM.
Does clearing the page file improve security?
Yes, in a limited sense. The page file can contain remnants of data that was in RAM, such as passwords or document contents. If you are selling or disposing of a computer, clearing the page file (and ideally using a disk-wiping tool) is a good security practice. For everyday use, it is not necessary.
What if I get a blue screen after disabling the page file?
If you disable the page file and your system becomes unstable, re-enable it immediately. Boot into Safe Mode if necessary, go back to System Properties, and set the page file to System managed size. The system should recover.
Can I move the page file to another drive?
Yes. In the same Virtual Memory dialog, select a different drive, choose a custom size or system managed, and click Set. This can help if your system drive is low on space, but note that using a slow drive may degrade performance.
Is there a way to clear the page file on every shutdown?
Yes, but it is not recommended. You can enable a Group Policy setting called “Clear virtual memory pagefile when shutting down” (Computer Configuration > Windows Settings > Security Settings > Local Policies > Security Options). This forces Windows to overwrite the page file with zeros each shutdown, which slows down shutdown and can wear out SSDs. It is only useful for high-security environments.