All operating systems require virtual memory, which is a combination of RAM and a portion of your hard drive called the Swap file, Paging file or Pagefile. Whenever RAM is not enough, Windows makes use of the Swap files to temporarily store files and, then, swap them back to the RAM when required. Virtual memory can be considered as being an extension of the computer's physical memory.
In Windows 10 this file is named pagefil.sys (invisible to the user), and there's an easy way to adjust its default size or disable it.
Click Start > File Explorer. Right-click on This PC, then left-click on Properties > Advanced System Settings > Advanced tab > Performance. Click Settings :
In the Performance Options window, go to the Virtual memory section, and click Change:
By default, the size of the paging file is managed by Windows. Because of this, the first step is to clear the Automatically manage paging file size for all drives checkbox:
Now that the options have been unlocked, you can move onto the next step.
Move the Paging File to Another Partition
If you're running out of space on your primary partition, then you can move it to another one (same drive).
Disabling the Paging file
Select the primary partition for the list, choose No Paging file, and click Set:
Enabling the Paging File
Now that the paging file has been disabled on the first partition, select the one that you want to use, and pick either System managed size or Custom size.
System managed size allows Windows to dynamically manage the size of the paging file:
Custom size allows you to set the size of the file. Choosing a custom size is tricky — the idea is to limit the Maximum size so that the paging file does not become too big, although it will be limited by the size of the partition size:
As a general rule, the maximum size of the paging file must be 1.5x the amount of RAM installed. So, for a PC running on 4 GB of RAM, the maximum size of the swap file will be 1024 x 4 x 1.5 Mb.
When to disable the paging file? Unless you want to use Windows' hibernation feature, you can safely disable the paging file for PCs equipped with 8 GB of RAM (and more).
Virtual memory and SSD? It is imperative that you turn off the paging file on an SSD. The constant writing/deleting of files will definitely have a negative impact on your SSD's life span.
A paging file for each partition? If you are using a single drive with multiple partitions, enabling a different paging file on each of them won't necessarily speed up the swapping of files. It will simply increase the time that Windows requires to search for the swap files (stored in multiple locations).