When the physical RAM installed on the system isn’t enough to meet the demands of the active processes, Windows moves pages of virtual address spaces to the pagefile. This allows the OS to repurpose part of the storage drive as memory in a process known as paging.
Thus, to increase the virtual memory size on Windows, you’ll need to increase the page file size. Doing so has various pros and cons that confuse users, and you might also be unsure how much virtual memory is best for your system. We’ll attempt to answer all such queries with this article.
How to Increase Virtual Memory Size?
The usual recommendation regarding virtual memory size in Windows is to use 1.5 times the amount of the installed physical RAM. For instance, in a system with 8 GB RAM, you’d set the virtual memory to 12 GB. Generally, that’ll work fine. In such cases, you can use the following steps to set the virtual memory size on Windows:
- Press Win + R, type
systempropertiesadvanced
, and press Enter. - In the Performance section, click on Settings.
- Switch to the Advanced tab. Click on the Change button under Virtual Memory.
- Uncheck the Automatically manage paging file size for all drives option.
- Now, select Custom size. Enter the Initial and Maximum size in MB and click on Set > Ok.
After setting the virtual memory size, be sure to keep an eye on your system performance. Any issues you were facing due to low memory will generally be resolved at this point.
In some cases, setting the virtual memory too high can have the opposite effect and slow down the entire system. Slowly lowering the pagefile size and experimenting with different values can help with this.
But if you’re up for it, understanding how virtual memory and pagefiles work in Windows can be an even better approach to determining the appropriate virtual memory size for your specific setup.
How Do Pagefiles and Paging Work?
Most programs and system processes in Windows reference memory through virtual memory addresses. The Memory Management Unit (MMU) translates these to real memory addresses.
Typically, when the memory demands of the running processes exceed the available RAM, the OS transfers pages of virtual address spaces (typically 4 KB blocks) to the storage drive. Basically, paging frees up RAM space for other purposes.
These pages are stored in files named pagefile.sys
, and the size of these files determines the virtual memory size of your system.
Why Are Pagefiles Necessary?
Typically, pages that aren’t accessed often are moved to the virtual memory. This allows the system to use the available RAM for higher-priority pages, which, as we’ve discussed, is the main use of page files.
However, there are other reasons as well to set up an appropriate-sized page file. In most cases, dedicated dump files aren’t enabled. Thus, page files are used to backup dump files in the event of a system crash.
Additionally, if the system commit limit is exceeded, you’ll encounter system issues like freezing and crashing. Since the commit limit is the sum of physical and virtual memory, a pagefile can prevent such problems by significantly raising the commit limit.
Raising the commit limit may not be necessary for systems with large amounts of physical memory, but pagefiles can still be useful during system crashes, as covered earlier.
Setting the Pagefile Size Too High
The previous section discussed issues stemming from a small-sized or non-existent page file. But on the other hand, a pagefile too large also comes with its own set of problems.
For starters, virtual memory is used even when the memory demands don’t exceed the available RAM. And RAM speeds are orders of magnitude higher than storage media speeds.
When you need to run a program that was paged to the virtual memory, it needs to be swapped back to the RAM for it to run. When you factor in the significantly slower speeds of storage media, it’s easy to see why the performance is impacted. In such cases, lowering the pagefile size to an appropriate amount should resolve most lag-related issues.
How Much Virtual Memory Is Ideal?
As stated, the general recommendation of 1.5 times the RAM will work most of the time. If you encounter any problems with this configuration, experimenting with different values, both on the higher and lower ends is an easy solution.
However, if you really want to fine-tune the pagefile size, there are a few main factors worth considering:
- Workloads: If you tend to max out your RAM usage, allocating at least the same amount as your RAM is a good idea.
- Crash Dumps: A complete memory dump calls for a page file of the RAM size + 1 MB. Kernel dumps require roughly one-third of the size of the installed RAM.
- Commit Limit: On a system with a low amount of RAM, higher virtual memory can be useful for raising the commit limit. On systems with high RAM, a pagefile may not be necessary at all for this purpose.
Since manually setting the pagefile size can get confusing, you might wonder if you can simply let the OS handle this mess. The short answer is that it just depends.
In some cases, letting the OS dynamically manage the pagefile size according to the current requirements works fine. In other cases, users have faced major performance issues when Windows uses a much larger page file than the recommended amount.
Our suggestion is to try out the automatic option for a bit. If it works for you, might as well stick to it. But if not, this guide should be helpful for manually setting the pagefile size.