Paging file (aka pagefile, virtual memory or secondary storage) is like an extension to available RAM (Random Access Memory, not hard drive): when RAM is nearly full, some contents of it are written to hard disk drive to keep up with the growing demand for memory space. Because data transfer rate of traditional and hybrid hard disk drives is much lower than that of RAM modules, frequent reading from and writing to paging file/virtual memory reduces the performance of running programs and Windows itself.
Windows tries to grow paging file dynamically. It might seem a very good idea to keep the paging file size at its optimum (just as much as needed), but in real life the growing and shrinking paging file gets fragmented quickly and starts decreasing overall performance.
To prevent that from happening, set paging file to a fixed size. But please remember, if you upgrade memory (add more RAM) later, you must also reconfigure paging file size accordingly - otherwise you'll see the dreaded "your computer is low on memory" errors while running multiple programs at once.
Some users turn off paging file completely on Windows devices that have 16 GB or more RAM installed. This works in most cases, but if you run several memory-hungry programs (some games, Adobe Photoshop and Lightroom, design software, etc) at the same time, you must enable virtual memory to prevent low memory errors and crashes.
Windows 8 and later tell you in the "Your computer is low on memory" dialog which program or app is using the most of RAM.
Please note that this tutorial is only meant for devices that have Windows installed on a traditional hard disk drive (HDD) or hybrid drive (aka solid state hard drive / SSHD).
If Windows is installed on an SSD (Solid State Drive) or paging file is stored on an SSD, you should let Windows manage paging file size automatically. This prevents wearing out the sectors where virtual memory file is stored. SSD-s have no issues with fragmentation thanks to no moving parts.
You can use Task Manager and Resource Monitor to see which programs use memory the most.
Open System Properties or System Information using keyboard shortcut Windows Key+Pause. Alternatively, right-click Computer or This PC icon on Desktop or Start menu/Start screen and click Properties.
In Windows XP, System Properties window opens right away. In Windows Vista, 7, 8, 8.1 and 10, click or touch Advanced system settings on the left first.
Open Advanced tab in System Properties window. Click or tap Settings in the Performance section.
Performace Options window opens. Move to the Advanced tab and click Change in Virtual memory section.
In Windows Vista and later, clear the Automatically manage paging file size for all drives check box first. Windows XP does not have this option.
Last warning: these instructions are meant for hard disk drives (HDD) and hybrid drives (SSHD) only! Paging files on SSD-s must be automatically managed to prevent decreasing the lifetime of the drives.
In Virtual Memory window of Windows XP, Vista, 7, 8 and 8.1, find the last section, Total paging file size for all drives, and see what's written in the Recommended row. Add about 200-300 megabytes to this value to get a good paging file size.
Windows 10 drastically reduces the recommended size for paging file. The suggested number is fine for casual usage scenarios (web browsing, e-mails, basic document and spreadsheet processing, etc), but it might be way too low for memory-intensive tasks such as video editing, CAD, 3D modelling, etc. Adobe's Photoshop and Lightroom are the bad examples of photo editing software that use bucketloads of RAM.
If you use such programs, launch them for at least 10 minutes while performing your common tasks. For example, launch Photoshop, open a few files, add layers, do some retouching, apply filters, etc. Do not close the memory-hungry program(s) and re-open the Performance options window. Use the number in the Currently allocated row and add at least 500-700 megabytes to it.
Next, click to select your system drive (the drive where Windows is installed, most probably with drive letter C:) in the list of available hard drives. Click Custom size and type the calculated value (Recommended + 200 MB; or Currently allocated + 500 MB) into Initial size (MB) and Maximum size (MB) fields. Verify your device has sufficient amount of free space on the selected drive by looking up the value in Space available row.
If your PC has at least 16 GB of RAM installed, you can also select No paging file here. Please note that this makes troubleshooting system crashes with WhoCrashed harder, because crash dump files are disabled after activating this option. You need to allocate at least 2-16 MB for paging file (see the Minimum allowed row) in order to activate crash dumps.
Click or tap Set.
In case you have multiple physical drives (not partitions or volumes!) in your PC, you can enhance performance even more by putting a larger part of paging file to the secondary drive. Leave about 100-300 megabytes of paging file on system drive and put the rest on the other drive (select the secondary drive in the list, click Custom size, specify values and click Set).
Do not keep paging files on external drives - this will reduce performance a lot.
Click OK in the Virtual Memory window to accept changes.
In most cases, a notification stating "The changes you have made require you to restart your computer before they can take effect" appears. Click OK - your PC will not restart yet!
Close Performance Options and System Properties windows and restart your device.
Final reminder: please remember to resize paging file if you add more RAM to your device later.
You can verify that virtual memory size is sufficient by looking for Event ID 49 (Configuring the Page file for crash dump failed. Make sure there is a page file on the boot partition and that is large enough to contain all physical memory) in System Log of Event Viewer. If there are recents events with ID 49, you need to increase the size of virtual memory.
To defragment Windows paging file and get even better performance, install Defraggler and turn on boot time defrag.