The Infamous Page File – How Big, Where Should I Put It, and Do I Need It?


pagefile-image

The Page File

Ah, the Page File, or Swap File as it has been called.

The Page file has been a source of debate for decades- How big should it be? Where should it be located? Do I need one at all?

To answer these burning questions we have to think about the logistics and how Microsoft implements it on a clean installation of Windows.

It used to be, and maybe still is so, that the size of the Page File was based on the amount of RAM you had installed on your computer. The formula is very simple: 1.5 times RAM. So, if you have 1GB of RAM, the Page File would be sized at 1.5GB.

That may have made some sense in the “old days” when ~64MB was the norm. These days, we’re talking about RAM in the Gigabyte realm.


Think about this for a minute. I have 16GB of RAM installed on my system. Now, does it make sense to you that I should then have a 24GB Page File? Of course not. In fact, I shouldn’t need a Page File at all. But there are proponents of keeping a Page File even with large amounts of RAM installed. Listen to this:

“Some feel having no paging file results in better performance, but in general, having a paging file means Windows can write pages on the modified list (which represent pages that aren’t being accessed actively but have not been saved to disk) out to the paging file, thus making that memory available for more useful purposes (processes or file cache). So while there may be some work loads that perform better with no paging file, in general having one will mean more usable memory being available to the system (never mind that Windows won’t be able to write kernel crash dumps without a paging file sized large enough to hold them).”
– Mark Russinovich

So, that answers the question about implementing a Page File, or not. If you don’t care about crash dumps, and have plenty of memory to handle all your running programs, then, I guess, you don’t need one.

Note: I haven’t used a Page File for several months now as an experiment. It turns out that Windows works just fine without one and, keeping in mind that I have a lot of RAM to play around with,   I really don’t see any reason to implement one. But. I am gong to do so anyway to see if there is any notable difference in the responsiveness of my system. I’ll let you know how it goes in the near future. Remind me…

You’ll see near the end of this article that I don’t recommend disabling the Page File. Adjustments are fine. Do as I say, not as I do. It’s my job to take risks in order to save you the headaches.

How to Manually change Its Size

In Windows 7 click the Start Button, choose Control Panel, then System. That will open this window:


pagefile-image-1

In the left pane, click Advanced system settings to get to this window:

pagefile-image-2

Clicking the Settings Button in the Performance box will bring you to this window:

pagefile-image-3

You’ll notice the little check box indicated in the above image. This determines whether you are in control, or Windows. I’m sure you can already guess how I feel about this.

It’s time to make some decisions. Ideally, you’re going to want your Page file on your fastest hard drive. If you have more than one hard drive, it is better to put it on the hard drive that does not include your operating system.

Here are some general rules of thumb:

  • If you have one HDD, then it’s a no-brainer. You have no choices to make. Putting a page file on a second partition does not help; in fact, it may even slow things down.
  • If you have 2 drives, then put it on the second drive. That’s the one without your Windows Operating System. Put it on the first partition of that drive as it is the most quickly accessed. Even if it is somewhat slower than your primary drive, this can still be the fastest setup. You really don’t want the Page File on your system drive if you can help it.
  • As an aside, I’d like to point out that Temporary files, such as browser caches, should also be put on a second drive for the same reasons.

How to tell which drive is faster?

There’s a great, free utility called HDTune that will do just that. There is also a Pro (paid) version available.

hdtune-image-1

Note: the above image is of HDTune Pro. There is a free version available, too.

If you download this program and run it against all your drives, then all your questions will be answered regarding HDD speeds. You can find it here: HDTune Download Page

How Big should It Be?

As I pointed out earlier, Windows will recommend a Page File size of 1.5 times the amount of RAM you have installed in your system. That’s a 24GB Page File on my 16GB-RAM computer. What if I was one of the lucky people out there that had 32GB of RAM? Then what? A 48GB Page File?! Horse hockey!

Let’s get back to reality here.

pagefile-image-31

On my computer, 16MB is the smallest Page File Windows allows. (Actually, you can disable it but Windows will complain.)

You want to make sure to uncheck the indicated box at the top of the above image (you don’t want Windows to manage the Page File in this circumstance). You want to be sure to have the Radio Button labeled Custom size ticked.

The above image is an old one and no longer represents my current recommendations. You’ll see that the primary C drive has a dynamic Page File setting of 16MB – 1024MB. This means that Windows will initially set up a 16MB Page File, but if it needs more, it can expand this size to a full Gigabyte (1024MB). Don’t forget to click the Set Button to invoke your settings. If you fail to do this, nothing will change. You will have to reboot your system for these changes to take effect and Windows will not forget to remind you of this.

You may have Page Files set up on every drive/partition on your computer. I can’t think of a single reason to do this. If you do choose to set them up on more than one drive, it is my understanding that Windows is smart enough to use the fastest one. I have not personally tested this and cannot make any claims to its accuracy.

Static vs Dynamic Page Files

There are two ways you can set these things up. Static or Dynamic.

A Static Page File has its minimum and maximum sizes set the same. There will be no changes from its original (minimum) size. The advantage here is that no disk fragmentation will occur.

A Dynamic Page File will begin its life at the minimum setting but may grow as the system needs increase.

The choice is yours.  I prefer a Static Page File because of the potential fragmentation problems that will be incurred by a dynamic Page File.

Conclusions

I don’t recommend eliminating the Page File. The crash dump reason pointed out by Mike Russinovich in the earlier quote is good enough reason for me.

It all really boils down to how much RAM you have installed and, once again, what your particular computing habits are. If you don’t have very much RAM and like to open a lot of applications, then you’ll need a larger Page File to accommodate that type of behavior.

A Word About RAM

After doing considerable poking around, Googling (yes, that’s a verb now), and Binging, and Groking, and reading far too many benchmark results, I have come to the conclusion that Windows 7 has a sweet spot when it comes to RAM. It seems to like 4 Gigabytes. Speed tests with more than 4GB on up don’t show a significant boost in performance. The only exception would be with video editing and CAD where RAM becomes extremely critical.

Before the advent of Solid State Drives a RAM upgrade was the single best bang-for-the-buck improvement you could make to your computer. And it still is if you are RAM shy. RAM is dirt-cheap these days.

If you are running Windows 7 and have less than 4GB RAM, and have a computer that supports it, buy some RAM for a big boost in performance. You’ll know if you need it because your Page File is being utilized. If you need a Page File, you don’t have enough RAM to begin with.

Note: If you are running a 32-bit version of Windows, then 4GB is the most RAM that system can access. Anything more than that is wasted.

Many people get concerned when all their RAM is being used. They seem to think this is a problem. There are many shady software vendors out there that will try to convince you this is a bad thing and also attempt to lighten your wallet in the process– you know, to fix it. This is a terrible misconception.

“Unused RAM is wasted RAM.” You really do want it all used, all the time.

Happy tweaking,

Richard

About the Author

Richard Pedersen

Richard received his first computer, a C-64, in 1982 as a gift and began dabbling in BASIC. He was hooked! His love for computing has led him from the old “XT” boxes to the more modern fare and from clunky 10MB hard drives to smooth and fast modern day SSD drives. He has run BBS services, Fido mail, and even operated his own computer repair business.

19 Comments

  1. Your conclusions agree with what I’ve learned over time.

    The one thing I’d like to do is figure out how to convince my system to use more of my limited (3GB) RAM and less swap file. It seems to rarely use more than half of my RAM, while using various amounts of swap file.

    I agree with your last statement, so is there anything I can to to encourage Windows to “waste” less RAM?

    • Hi Ron,
      You pose a very interesting question.
      On my 16GB computer Windows typically uses around 12% to 18% of it. And no Page File. Excluding Windows 8, Windows 7’s memory management system is purported to be the best so far. We may simply have to presume that Windows knows what it’s doing and leave it alone.

      I honestly wouldn’t know how to convince Windows to use more RAM without making the Page File smaller. Unless your Page File is way too big, I wouldn’t suggest that route, though.

      There also may be some registry hacks that would change this behavior. I know there’s a setting in there somewhere that affects the way Windows handles memory, but for the life of me, I haven’t been able to find it right now. I’ll keep digging.

      I hope one of the readers out there can give this question a proper response. I’d be very interested in hearing more about this,
      Richard

  2. I have also experimented with this for years like you. One thing you leave out is that you much have at least a small swap file on the system drive in order for the dump files to work properly. So in my system with 5 drives I still keep a 256MB swap file on the system drive just to make sure I get my dump files when needed. I use a secondary drive for most of the swap space.

  3. I have Win 7 64bit with 4GB RAM. I tried disabling this at one time and the only downside I noticed was that backing up my system took forever. I use Macrium and Windows built in backup to make system images. It usually takes about a hour. I have a 500GB drive with about 50 GB used. With paging disabled Macrium took about 10 hours to make a system image and Windows backup – I had to let it run overnight. I currently use a paging file.

    • Hi Terry,

      Some programs rely on a Page File whether Windows needs it or not. I use Acronis and if I have a Page File set up, it will use it. Unlike your situation, I have not noticed a degradation with or without a Page File.

      As I mentioned, I don’t think it’s a good idea to eliminate the Page File completely regardless of how much RAM you have.

      Thanks for the information,
      Richard

  4. Richard, Leland said you must keep at least a small page file on your system drive, for dump files to work properly. You said he might have missed it but you mentioned it twice. But under ‘some general rules of thumb’ you advised: If you have 2 drives, then put it on the second drive. That’s the one without your Windows Operating System. Put it on the first partition of that drive as it is the most quickly accessed. Even if it is somewhat slower than your primary drive, this can still be the fastest setup. You really don’t want the Page File on your system drive if you can help it. !!!

    But surely that is not only the opposite of what Leland said but also contradicts what you said about mentioning that you should leave a small page file on your system drive?

  5. Sheri and Leland,

    I will try to clear this up and not muddy the waters too much.

    Leland: I may have been too abrupt in my reply and entirely missed your point.
    It is not necessary to keep the Page File on the system drive in order to grab the crash dumps. Windows does not care where the Page File is as long as there is one.

    Sheri: I’m sorry if my conclusions seemed contradictory. I’ll try to make this clearer.
    If you only have a single drive, then you have no choice but to keep the Page File on it.
    If you have two drives, then it is better to keep the Page File on the second drive.

    I hope this helps. Please continue to help me straighten this out for you both if you have any further questions,
    Richard

  6. That’s really handy Richard.
    Since I did a new install about 6 months ago, I totally forgot to address this issue and just let Windows manage it.
    However, since I also have 16Gb and Windows kindly allocated 24Gb, I moved the swap to the other physical drive and set it at 4096Mb, things actually seem to have speeded up noticeably.
    Now, about the hiberfil.sys……

    • Hi Marc,
      The hibernation file is a totally different animal. For practical reasons it has to be on the same drive as the operating system. If you did find a way of moving it, it wouldn’t work.

      It will also be roughly equal in size to the amount of RAM installed in your computer– in your case, about 16GB!

      My suggestion is that if you don’t use it, lose it. You’ll free up a ton of disk space by doing so.

      It’s quite simple to do as well:

      1. Open an Admin Command Box
      2. Type: powercfg -h off (you can re-enable it by changing “off” to “on” at any time)
      3. Hit
      4. You should check your Power Settings to make sure it is disabled there as well.
      5. Re-boot your computer

      Check the root directory and the hiberfil.sys file should be gone; if not, just delete it.

      Note: DCT has an article on this very subject: http://www.davescomputertips.com/windows-hibernation-file-do-you-need-it/

      Hope this helps,
      Richard

    • powercfg.exe /hibernate off
      That is if you dont use it… On my desktop I do not. that may require a restart but afterwards you shouldnt see it.

  7. I have 32GB of ram. Should I remove the pagefile.sys file or make it smaller? My operating system is installed on a SSD so I have very little room on it. I have an extra ssd and a regular hard drive as well. Should I consider splitting the pagefile to my other drives?

    • Hola Jose,

      My personal suggestion is not to remove the Page File. Windows uses it regardless of how much RAM is installed.

      I would suggest moving it to a “spinner” and giving it a fixed size based on how much memory you will actually need in your day to day usage of the system. Getting it off the SSD is a plus, regardless of what MS says or wants.
      It most certainly does not have to be part of your backup routine.

      32GB of RAM is huge, even by today’s standards. Granted, you probably don’t need a page file, but Windows will still use one if it exists. I keep a small one for memory dumps on a partition set up on a “spinner” for that purpose. I have a paltry 16GB of RAM, so I am only half the man you are 🙂

      Given today’s large drive capacities, a couple gigabytes of wasted space is not an issue. I’d just get it off the SSD.
      Also, considering your vast RAM, a slow “spinner” no longer enters into the equation.

      Thanks for the comment,
      Richard

  8. For 32 bit Windows you can use RAM above 4GB RAM as a Ramdrive and put the Pagefile there. This will be a big boost for your your windows. For 32 bit PC WIN XP with “only” 2 GB RAM some 0,5GB RAMdisk for pagefile will speed up your system. Define a fixed size Pagefile for the RAMdisk and a dynamic pagefile for the HDD (16MB – XXXMB). Search for Gavotte Ramdisk and read instructions for >4GB. There is more comfortable shareware out there