I’ve been running out of space on my boot drive, a 250 GB SSD, but I’m reluctant to upgrade it with another SSD because I am overhauling my system shortly and will go NVMe rather than SATA. However, it does mean I have to keep on top of things so I don’t get the dreaded error about scratch disks being full in Photoshop. One of those things is the enormous pagefile.sys that Windows keeps generating.

I’m not sure why either – I’m running 16GB of RAM, which should be enough for my usage but still Windows 10 insists on using a pagefile. Can see how Windows uses a pagefile by typing ‘performance’ in the start menu and clicking ‘Adjust the appearance and performance of Windows’.
When the Performance Options window opens, click on the Advanced tab and then Change… at the bottom and you will open the Virtual Memory window as seen below.

You can actually specify the paging file size for drive(s) by setting its intial size when Windows boots and the maximum size it can have. I’ve experienced difficulties on a few host machines in the past when I’ve done this and also noticed the pagefile goes straight to the maximum size quite quickly. The current recommendation is to always let Windows manage the pagefile i.e. leave System managed size selected.
That being said, I leave my desktop on 24/7 and my pagefile was getting enormus every few days or sometimes hours. The system would grind to a halt, let alone not be abel to launch anything, so I needed a quick way of deleting the pagefile without causing issues – investigating why it gets so big is then next.
There’s a simple fix so that Windows clears the paging file on shutdown and this can be activated in the Windows Registry. Type “regedit” in the Start Menu and navigate to the following folder:
Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management
Double click the key ClearPageFileAtShutdown and change the value to “1” (without quotes!) as shown below. OK out and close the Registry Editor to save the changes.

I awlays restart to commit registry changes and now upon subsequent restarts or shutdowns, the pagefile will be cleared. This actually, importantly, has a security benefit to it as well.