Virtual memory is a technique used by operating systems to access a greater amount of memory than the physically available, resorting to alternative storage solutions when the installed RAM is exhausted. In this article we will learn how it works and what we must do to configure it optimally.
As many readers know, computers use RAM to store the files and data needed by both the operating system and the software that we are running; its high performance guarantees optimum operation but, sooner or later, it always ends up filling. It is at this moment when Windows needs to resort to virtual memory.
To create the virtual memory Windows creates a file in the storage unit we have assigned, be it a traditional hard disk or an SSD; the operating system generates a file called pagefile.sys (you can find it hidden in the root directory of your system) where it stores the data that does not fit in the RAM but is necessary for the computer’s operation.
So when you run very demanding applications (like video games, for example) or if you have several applications running at the same time you can notice how the system slows down, especially if you are short on RAM. That is the moment when Windows is turning to the paging file and the RAM has been overwhelmed; crashes and instability are avoided, but in return the performance decreases considerably.
At this point, it is easy to conclude that the more RAM we have in the computer the better and we will notice the difference the more demanding the software we use. Although its price has dropped dramatically in recent years it is still high, so in most scenarios it is necessary to resort to virtual memory solutions.
Recommended virtual memory size in Windows 10
By default, Windows 10 allocates a certain amount of space from our hard disk or SSD as virtual memory, depending on the configuration of our computer and taking into account parameters such as the storage capacity or the amount of RAM installed.
On computers with 64-bit systems and more than 8 Gbytes of RAM, the default configuration is appropriate for most scenarios. You may have read articles where they recommend various formulas in which you multiply by some factor the amount of RAM available to determine the minimum and maximum size of the paging file but, from my point of view, this is not necessary.
The dynamic allocation system of Windows 10 works quite well and it is able to resize the file size dynamically as needed, avoiding unstable situations or unexpected crashes as soon as an application overflows the RAM consumption (for example, some web browsers). So, my recommendation for almost all readers is to not touch anything. The only thing you should worry about is to keep the drive where you have the operating system installed (usually C:) with at least 15% free space.
The exception to this rule is older computers, with less than 2 Gbytes of RAM and using systems such as Windows XP or Windows Vista. The reason is that, with the passage of time, the applications we all use have become true RAM devourers, even those as reputable as, again, web browsers or office suites. In that context, it is worthwhile to manually assign the minimum paging size to 1.5 times the amount of RAM installed and the maximum to about 3 times the amount of RAM or directly 4 Gbytes, whichever comes first.
At the end of this text you will see how to determine the perfect paging file for your system but it is not recommended to follow general recommendations or configurations that you see on your family or friend’s computer. Each computer has its peculiarities and we don’t all use our computers the same way, so unless you want to waste time tuning your system to the maximum or you have a computer with very little resources, chances are that a manual configuration will not bring great benefits.
Should I turn off virtual memory?
The short answer is no. Although you may think you have more than enough RAM for the use you give your computer, there are applications that generate peaks in memory consumption and others that directly need a paging file to work. It is possible that in the short term you notice a performance improvement in some scenarios but from my point of view the improvement does not compensate for the loss of stability it can cause.
If you have a lot of RAM the pc will try to use it optimally, so your biggest problem with leaving the paging file active is the storage space it consumes (which, in modern equipment, should not be too much of a problem). Under normal conditions, Windows 10 performs very efficient memory management and will always offer the fastest memory option to the applications in order to offer optimum performance without compromising the overall stability of the system in any case.
At this point it is important to note that Windows does not always detect errors in virtual memory. So it is possible that errors appear after changing virtual memory settings and you won’t be able to blame an erroneous configuration of the virtual memory.
Does it serve any purpose to move the paging file to another partition or unit?
It is not advisable to put the paging file into a partitioned unit; virtual division may increase search times and lower performance, although it is less noticeable in modern disk units and nothing at all in an SSD. When it comes to changing the file to a different unit, the recommendation is simpler: the paging file must be in the fastest storing unit you have on the device. Whilst on the matter, forget about recommendations that suggest using external units.
If we have more than one storage units in our device, a paging file can be created (and configured) for each volume. Windows can manage them and have no performance issues, but it is important you do not create various paging files on the same physical volume; you’d provoke the system to function slower.
Should I allow Windows to use my SSD for the paging file?
We know that SSDs are expensive and it may ‘’hurt’’ to loose some GBs in the paging file but from the performance point of view there is no debate. There are lots of myths regarding the useful life of an SSD (you may read more about that in this article) but in devices less than five years old there’s no need to worry. A last recommendation is: always leave at least 15% of your SSD free to prevent scenarios where Windows might need to increase the size of said file and enhance the stability of the system.
I want to configure my paging file manually, what is the best formula?
If, regardless of the recommendations, you want to maximize the configuration of Windows’ virtual memory, my advise is to use the Resources Monitor provided in Windows and reproduce the maximum demand scenario possible; take note of the maximum RAM demand peak of your system. This value must be the minimum you insert in the Windows paging file, multiply it threefold and set it as the maximum value.
It is possible to simulate maximum peaks of CPU, disk or RAM usage with tools like these, but, once again, take precaution, it is not recommendable to submit your hardware to extreme tests if you’re not sure of what you’re doing. In general, a good amount of time where demanding applications are executing at the same time and an open tab of Resources Monitor will suffice to have an idea of our device’s memory needs, always in accordance with our usage profile.
Modifying the configuration is simple, but it never hurts to remember; in Windows 10 you only need to write System in the Start Bar, access the Advanced System Settings and in Advanced Options, click on the option Settings in the performance section, then click Advanced – Change. You might see something similar to this screen capture.
If you have extra space in your hard drive you don’t need to be afraid of assigning a great deal of space on this task (even better if you have an SSD) because you will enhance the stability of your system in compromised situations, but it isn’t wise to over assign said space; it would be a waste of resources and you’d obligate Windows to manage a file much fuller of empty space that won’t be needed.
To finalize, a recommendation for those that want to know more about the topic: in this article by Mark Russinovich, expert on Microsoft Operational Systems, he explains with full detail how paging file work, and what tests you can use to determine how virtual memory is used in your device. I invite you to share and debate regarding your virtual memory configuration in the comment section.