ubuysa
The BSOD Doctor
Following the 'Understanding RAM' post I've received a PM about the page file, how big to make it, where to put it, and whether you even need one at all. Here's my views on the page file then....
From the 'Understanding RAM' posts you'll know already that virtual memory pages can reside either in RAM or in the page file. If the pages in RAM are being regularly used they will stay in RAM, but if RAM is being heavily used those pages in RAM that are not being regularly used can be paged out to the page file (freeing up the RAM they were occupying). This means that the page file isn't like any other disk file, it's actually part of your memory subsystem and is thus just as important to you as RAM.
The downside to paging out unreferenced pages is that when (or if) a paged-out page is later accessed, Windows has to allocate a new page in RAM, locate the paged-out page in the page file, and bring that page into the newly allocated RAM page. This takes time (it's a disk read after all) and the executing thread is suspended whilst this is going on (the thread is actually in a wait on the page-in, when that's done the thread continues executing). You see this as sluggish performance in the application concerned, so whilst paging is a good thing for RAM management it's a bad thing for performance. (Note that the page-out doesn't cause any performance issues because the page was not being used at the time. Note also that Windows pages in the requested page and several pages around it to try and avoid additional page faults).
Since unreferenced pages are typically only paged-out to the page file when RAM is heavily used, and since most of us these days have 8GB, 16GB, or more, installed RAM (which is almost never fully used) there won't be any actual paging to the page file going on.
Since a page file takes up at least the same number of GB as installed RAM, if there is lots of RAM installed you can do without a paging file and use that disk space for something else, right? The answer to that is a definite...maybe.
A 16GB (say) page file is a lot of disk space to consume for no apparent purpose, but these days we are installing 1TB, 2TB, or even bigger, disk arrays. 16GB on a 1TB disk is less than 2% of the total disk space. Even if your only disk is 256GB, as it might be on some smaller laptops, a 16GB page file is only about 6% of the available disk space.
Here's why you need one...
Open up the Task Manager, click the Performance tab, and then click the Memory icon on the left. Below the two graphs are some numbers, look at the Committed numbers. Committed memory is virtual storage space that Windows has approved for use by processes. The first of the two numbers is the amount of virtual storage currently approved for use, the second is the maximum amount of virtual storage that Windows will ever allow at one time on this system. The maximum is simply the size of installed RAM plus the size of the page file - this is because ultimately virtual storage pages have to exist somewhere real, and that means either in RAM or in the page file.
This is important because all processes run in virtual storage, on 64-bit Windows a process can address up to 128TB of virtual storage and although this is a staggering amount the use of any of that virtual storage must be approved by Windows. If for example, the two committed numbers were '6.4/31.9 GB', that means that Windows has currently approved the use of 6.4GB of virtual storage in total and that Windows will never approve more than 31.9GB of virtual storage. That means that on this system no process can ever access more than 31.9GB of virtual storage - even though 64-bit addressing allows up to 128TB.
If you have no page file (because you have 16GB of RAM installed and you think you don't need one) then those two committed numbers would read '6.4GB/15.9 GB', which means that no process could ever access more than 15.9 GB of virtual storage - on a system that allows up to 128TB per process. Even worse, it actually means the sum of all the virtual storage being used by all processes cannot be more than 15.9GB. Note that the page file size can be dynamically increased, up to a pre-determined maximum, once this maximum is reached no more virtual storage can be obtained.
You might argue that 15.9GB is a lot of memory, but a few hundred browser pages, a couple of databases, and a bunch of other common applications could start to get very close to that, or even bust it. With no page file, exhausting RAM will result in a system crash. A page file increases the amount of virtual storage that Windows can approve, so even if you do run more applications than you actually have RAM, the system doesn't crash.
Talking about system crashes, you probably know that a system crash will generate a dump file. Although you may not know how to read a Windows dump file yourself, you do know that there are a number of people on here who do, so uploading the dump file to these fora could help get your system crash resolved.
Guess where system dump files are written? Yep, the page file. That's another reason why you need one!
Here's where to put the page file...
The page file is memory remember, so if your system is paging constantly you want the page file on the fastest disk you have. That means if you have an SSD you want the page file on the SSD. It is true that this may shorten the life of the SSD (by a small, but probably measurable amount) but the performance benefit of the rapid page-in far outweighs the lifespan of the SSD considerations. Incidentally, if you are running a system that is paging constantly you should plan for a RAM upgrade as soon as convenient (or reduce the number of concurrently executing applications). Note that you can have up to 16 page files, each on a separate volume, and Windows will use them all. On a heavily paging system multiple page files will improve performance a little.
If you are not paging very much (or at all) because you have plenty of RAM you don't need the page file on your SSD, so in this case the lifespan considerations of the SSD outweigh any performance benefit. In this case place the page file on a large HDD, it won't offer terribly good performance if you do start paging, but the system won't crash. If the system needs to write a dump everything is suspended whilst that happens anyway so the speed of the page file on the HDD isn't terribly relevant.
Here's how big to make the page file...
First, ignore all the common advice about making it 1.5 x RAM, that may have been a useful yardstick back in the days of XP but it's meaningless now. Windows 10 has a much better algorithm for automatically setting the page file size than previous versions of Windows did. You probably know that the size of the page file can be increased and decreased dynamically, and Windows 10 has improved algorithms in this area too.
To set the page file size (and location) enter 'sysdm.cpl' in the Run box, click the Advanced tab, click the Performance setting button, click the Advanced tab, and finally click the Change button.
My advice is to allow Windows to manage the size of the page file on Windows 10, especially if it's on a large HDD and you have plenty of RAM. In this situation you'll find Windows sets the minimum page file size to be a tiny bit larger than your installed RAM, this is so that it can hold a full memory dump. The maximum page file size will probably be around 3 x RAM.
If you really want to set an accurate maximum page file size yourself in order to minimise the page file size then you need to start every application you're ever likely to use, along with all the data sets and files they use, so that you're using as much virtual storage as you'll ever need. This is your maximum commit value, which you can read on the Memory page in Task Manager as we saw earlier. If you subtract the size of your installed RAM from this what's left is your maximum page file size (I'd round it up a bit just to be on the safe side). Make your minimum page file size the size of installed RAM (and set your maximum to this too if your calculated value is less than this) so that it can hold a full memory dump.
Note that pagefile.sys is a hidden file so you won't normally see it. You'll need to uncheck the 'Hide protected operating system files' checkbox in File Explorer Options to see it.
From the 'Understanding RAM' posts you'll know already that virtual memory pages can reside either in RAM or in the page file. If the pages in RAM are being regularly used they will stay in RAM, but if RAM is being heavily used those pages in RAM that are not being regularly used can be paged out to the page file (freeing up the RAM they were occupying). This means that the page file isn't like any other disk file, it's actually part of your memory subsystem and is thus just as important to you as RAM.
The downside to paging out unreferenced pages is that when (or if) a paged-out page is later accessed, Windows has to allocate a new page in RAM, locate the paged-out page in the page file, and bring that page into the newly allocated RAM page. This takes time (it's a disk read after all) and the executing thread is suspended whilst this is going on (the thread is actually in a wait on the page-in, when that's done the thread continues executing). You see this as sluggish performance in the application concerned, so whilst paging is a good thing for RAM management it's a bad thing for performance. (Note that the page-out doesn't cause any performance issues because the page was not being used at the time. Note also that Windows pages in the requested page and several pages around it to try and avoid additional page faults).
Since unreferenced pages are typically only paged-out to the page file when RAM is heavily used, and since most of us these days have 8GB, 16GB, or more, installed RAM (which is almost never fully used) there won't be any actual paging to the page file going on.
Since a page file takes up at least the same number of GB as installed RAM, if there is lots of RAM installed you can do without a paging file and use that disk space for something else, right? The answer to that is a definite...maybe.
A 16GB (say) page file is a lot of disk space to consume for no apparent purpose, but these days we are installing 1TB, 2TB, or even bigger, disk arrays. 16GB on a 1TB disk is less than 2% of the total disk space. Even if your only disk is 256GB, as it might be on some smaller laptops, a 16GB page file is only about 6% of the available disk space.
Here's why you need one...
Open up the Task Manager, click the Performance tab, and then click the Memory icon on the left. Below the two graphs are some numbers, look at the Committed numbers. Committed memory is virtual storage space that Windows has approved for use by processes. The first of the two numbers is the amount of virtual storage currently approved for use, the second is the maximum amount of virtual storage that Windows will ever allow at one time on this system. The maximum is simply the size of installed RAM plus the size of the page file - this is because ultimately virtual storage pages have to exist somewhere real, and that means either in RAM or in the page file.
This is important because all processes run in virtual storage, on 64-bit Windows a process can address up to 128TB of virtual storage and although this is a staggering amount the use of any of that virtual storage must be approved by Windows. If for example, the two committed numbers were '6.4/31.9 GB', that means that Windows has currently approved the use of 6.4GB of virtual storage in total and that Windows will never approve more than 31.9GB of virtual storage. That means that on this system no process can ever access more than 31.9GB of virtual storage - even though 64-bit addressing allows up to 128TB.
If you have no page file (because you have 16GB of RAM installed and you think you don't need one) then those two committed numbers would read '6.4GB/15.9 GB', which means that no process could ever access more than 15.9 GB of virtual storage - on a system that allows up to 128TB per process. Even worse, it actually means the sum of all the virtual storage being used by all processes cannot be more than 15.9GB. Note that the page file size can be dynamically increased, up to a pre-determined maximum, once this maximum is reached no more virtual storage can be obtained.
You might argue that 15.9GB is a lot of memory, but a few hundred browser pages, a couple of databases, and a bunch of other common applications could start to get very close to that, or even bust it. With no page file, exhausting RAM will result in a system crash. A page file increases the amount of virtual storage that Windows can approve, so even if you do run more applications than you actually have RAM, the system doesn't crash.
Talking about system crashes, you probably know that a system crash will generate a dump file. Although you may not know how to read a Windows dump file yourself, you do know that there are a number of people on here who do, so uploading the dump file to these fora could help get your system crash resolved.
Guess where system dump files are written? Yep, the page file. That's another reason why you need one!
Here's where to put the page file...
The page file is memory remember, so if your system is paging constantly you want the page file on the fastest disk you have. That means if you have an SSD you want the page file on the SSD. It is true that this may shorten the life of the SSD (by a small, but probably measurable amount) but the performance benefit of the rapid page-in far outweighs the lifespan of the SSD considerations. Incidentally, if you are running a system that is paging constantly you should plan for a RAM upgrade as soon as convenient (or reduce the number of concurrently executing applications). Note that you can have up to 16 page files, each on a separate volume, and Windows will use them all. On a heavily paging system multiple page files will improve performance a little.
If you are not paging very much (or at all) because you have plenty of RAM you don't need the page file on your SSD, so in this case the lifespan considerations of the SSD outweigh any performance benefit. In this case place the page file on a large HDD, it won't offer terribly good performance if you do start paging, but the system won't crash. If the system needs to write a dump everything is suspended whilst that happens anyway so the speed of the page file on the HDD isn't terribly relevant.
Here's how big to make the page file...
First, ignore all the common advice about making it 1.5 x RAM, that may have been a useful yardstick back in the days of XP but it's meaningless now. Windows 10 has a much better algorithm for automatically setting the page file size than previous versions of Windows did. You probably know that the size of the page file can be increased and decreased dynamically, and Windows 10 has improved algorithms in this area too.
To set the page file size (and location) enter 'sysdm.cpl' in the Run box, click the Advanced tab, click the Performance setting button, click the Advanced tab, and finally click the Change button.
My advice is to allow Windows to manage the size of the page file on Windows 10, especially if it's on a large HDD and you have plenty of RAM. In this situation you'll find Windows sets the minimum page file size to be a tiny bit larger than your installed RAM, this is so that it can hold a full memory dump. The maximum page file size will probably be around 3 x RAM.
If you really want to set an accurate maximum page file size yourself in order to minimise the page file size then you need to start every application you're ever likely to use, along with all the data sets and files they use, so that you're using as much virtual storage as you'll ever need. This is your maximum commit value, which you can read on the Memory page in Task Manager as we saw earlier. If you subtract the size of your installed RAM from this what's left is your maximum page file size (I'd round it up a bit just to be on the safe side). Make your minimum page file size the size of installed RAM (and set your maximum to this too if your calculated value is less than this) so that it can hold a full memory dump.
Note that pagefile.sys is a hidden file so you won't normally see it. You'll need to uncheck the 'Hide protected operating system files' checkbox in File Explorer Options to see it.
Last edited: