Navigation

Set paging file to a fixed size in Windows

By . Last modified: 2014-08-14.

How to set paging file to a fixed size to avoid its fragmentation in Windows XP, Vista, 7, 8 and 8.1

Paging file (aka pagefile, virtual memory or secondary storage) is something like an extension to available RAM (Random Access Memory, not hard drive!): if main memory is nearly full, some contents of it are written to hard drive to keep up with the growing demand for memory space. Because data transfer rate for traditional hard drives is much more limited than that of RAM modules, frequent reading from and writing to paging file might affect performance of running programs and Windows itself negatively. If Windows is installed on SSD, the impact is much less noticeable.

You can use Task Manager and Resource Monitor to see which programs use memory the most.

Windows tries to grow paging file dynamically. It might seem a very good idea to keep the paging file size at its optimum (or 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) later, you must also reconfigure paging file size accordingly - otherwise you'll get random "your computer is low on memory" errors while running multiple programs at once.

Many users decide to turn off paging file completely on Windows PC-s that have 16 GB or more RAM. This seems to be working in most cases, so you can try this method out if you like adventures.

File fragmentation is a big issue on traditional hard drives (SSD-s do not count) that usually does not get much attention. File fragmentation occurs when a hard disk partition contains tens of thousands of files (like it always does) and a file gets updated but there is no room right after it to keep the file written sequentially. So the updated part gets written elsewhere on the hard disk, sometimes in one part, sometimes to several different places on the hard disk. This means that the next time Windows wants to read from or write to the file, the hard disk controller must access several places all over the disk to read or write information - meaning that the file's access time gets higher and you must wait longer for an operation to complete. For one file this might mean only a few milliseconds, but if your hard drive is nearly full and fragmentation level is high, this turns easily into tens and tens of seconds of waiting.

How to configure paging file in Windows

Open System Properties or System Information using keyboard shortcut Windows Key+Pause/Break. Alternatively, right-click Computer icon on Desktop or Start menu and click Properties.
Windows Vista, Desktop. To open Basic System Information, right-click Computer and select Properties.

In Windows XP, System Properties window opens right away. In Windows Vista, 7, 8 and 8.1, click Advanced system settings on the left.
Windows Vista, Control Panel. To open System Properties, click Advanced system settings.

Open Advanced tab in System Properties window. Click Settings in the Performance section.
Windows 7, System Properties, Advanced tab. In Performance section, click Settings.

Performace Options window opens. Open Advanced tab and click Change in Virtual memory section.
Windows XP, Performance Options, Advanced tab. In Virtual memory section, click Change.

In Virtual Memory window, find the last section, Total paging file size for all drives, and see what's written in the Recommended row. Add about 200 megabytes to this value to get a good paging file size.
In Windows Vista and later, clear the Automatically manage paging file size for all drives check box. Windows XP does not have this option.
Next, click to select your system drive (the drive where Windows is installed, most probably C:) in the list of available hard drives. Click Custom size and type the calculated value (Recommended + 200 MB) into Initial size (MB) and Maximum size (MB) fields. Verify you have 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 might make troubleshooting system crashes with WhoCrashed harder, because not all required information is written to crash dump file after activating this option.
Click Set.
Windows XP, Virtual Memory. Click Custom Size. Type equal values into 'Initial size' and 'Maximum size' fields. Click Set.

In case you have multiple physical hard 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).

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!
Windows 8, System Properties, The changes you have made require you to restart your computer. Click OK.

Close Performance Options and System Properties windows and restart your computer.

Let me remind you again - please resize paging file if you add more RAM to your computer 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.

To defragment Windows paging file, install Defraggler and use boot time defrag.

 

Sub Navigation

Sub Navigation

Next: Use Defraggler for defragmenting disks in Windows


Previous: Free up disk space in Windows