Setting Windows Virtual Memory, why you need to and what about SSDs?

Mike Halsey MVP
Aug 29, 2011
Updated • Aug 30, 2011
Tutorials
|
19

Virtual memory is a throwback to Windows of old, when the physical memory available to a computer was severely limited.  Essentially it uses a chunk of space on your computer's hard disk as a memory swap file.  Unfortunately, Windows has always been terrible at managing this file allowing to dynamically grow and shrink depending on what the operating system needs at the time.

You computer now may well have 2/4/6 or even 16Gb of RAM, but Windows is still using the swap file, primarily now for application compatibility.  With this file always growing and shrinking in size on your hard disk it's building up a fragmentation problem that will eventually slow down file access to your hard disk and that, potentially, could lead to data corruption.

Now, both of those scenarios with modern hardware are worst case, but it's always a good idea to manually manage the Windows swap file.  Why do I say this?  Because while I can't guarantee an unmanaged swap file will cause slowdown and data corruption, I can positively guarantee that a properly managed swap file won't.

You access the swap file properties in the Control Panel by selecting the System panel.  In the left hand panel (Vista and Windows 7) click the Advanced system settings link.

In the Window that appears, you'll see the Advanced tab open by default.  In the Performance section you need to click on the Settings button.

At this point a new Window will appear.  Under the Virtual Memory tab click the Change button to set the virtual memory manually.

At the next Window (seen below) there are several things you need to do.

  1. Untick the Automatically manage paging file size for all drives option.
  2. Choose the Custom Size option
  3. Set both the Initial size and Maximum size options to the Recommended value at the bottom of the window. NOTE: both values must be identical.
  4. Press OK to finish.  The changes will take effect the next time you restart your computer but there's no need to do this immediately.

Some people have questioned whether you should keep your paging file on the same disk as Windows is installed in your computer if that hard disk is an SSD.  The reason for this is that a paging file makes many millions of read and write requests over the lifetime of that copy of Windows, many more times that of any other file.  The argument is that this can significantly reduce the lifetime of your SSD which has a maximum lifespan of so many read and write requests.

Conversely, other people will say that moving the paging file away from the SSD will slow down Windows and undo some of the good of having it installed on an SSD in the first instance.

This is a decision you'll have to make for yourself and it comes down to a personal choice.  I'm not convince that moving the paging file away from Windows will affect performance adversely and on my own computer the power management powers-down the hard disk after a period.  This means that when I come to access a file from it I always suffer a delay while the computer spins it up again.  Having the swap file on the hard disk and not the SSD would get around this secondary issue.

On the image above you can see on my own computer the Windows 7 partition is highlighted.  It's here that I've got my own swap file stored.  Before moving the file to another disk simply click on the appropriate hard disk or partition in the list that you see.  The next time you reboot the swap file will be moved to this other disk instead.

Advertisement

Previous Post: «
Next Post: «

Comments

  1. Shaun King said on June 21, 2012 at 9:56 am
    Reply

    Need to know how to make pc think it has 8gig of ram or even better 16gig’s of ram How can I do that?

  2. Efrain said on August 31, 2011 at 2:29 am
    Reply

    What about disabling virtual memory & using the OS’s ReadyBoost feature? I think that might work best for some. It works great for me albeit probably not for everyone.

    Just putting it out there, hope this helps some people…I never really comment.

  3. jfjb said on August 30, 2011 at 9:09 pm
    Reply

    … or follow the master himself: Mark Russinovitch’s “Pushing the Limits of Windows: Virtual Memory” @
    http://blogs.technet.com/b/markrussinovich/archive/2008/11/17/3155406.aspx
    Very simple.

  4. DrTrunks said on August 30, 2011 at 9:02 am
    Reply

    You should always have the pagefile enabled for the sake of software compatibility.
    Some software (Adobe for one) will always use a pagefile wether you want it or not.

    If you want to know how large to set your pagefefile do the following:

    Open up Performance (start -> run -> perfmon)
    Remove the standard graphs and add the following:
    (If you have windows 7 or vista, i wont bother you if you have win XP x64)
    -Pagefile
    *percentage in use
    *percentage peakusage

    Set the duration for 15 minutes or so and then stress your computer to the max with what you usually do. Open 20 firefox tabs, photoshop, game, whichever.

    The ‘Maximum’ of ‘percentage in use’ will give you a clear idea of how big the pagefile should be.

  5. SubgeniusD said on August 30, 2011 at 5:39 am
    Reply

    Windows traditionally recommends 1.5 X installed RAM for pagefile. I set manually to 1 X but wouldn’t even use a pagefile if system was not installed on 500 GB HDD which is much larger then I actually need.

    Even with fairly high intensity multi-tasking going on I’ve never seen this system max out it’s 4 GB RAM. I just keep a pagefile out of habit and just in case maybe – like a spare tire I’ll probably never need.

  6. fokka said on August 30, 2011 at 12:02 am
    Reply

    omg, i would never waste that much precious ssd-spaze for a pagefile! with todays amounts of ram i would set it to 1gb max, or disable it altogether!

  7. geeknik said on August 29, 2011 at 10:57 pm
    Reply

    I have 24GB of RAM in this system, Windows 7 automatically allocated 24GB of disk on my SSD to the pagefile, however, Windows 7 was recommending 36GB for some reason. I dropped it down to 12GB.

    1. Jim Fell said on August 29, 2011 at 11:26 pm
      Reply

      When Windows crashes, “[t]he operating system deletes the contents of the page file and attempts to write the contents of RAM to the page file structure. Once written, the page file is renamed to memory.dmp and becomes the crash dump file.”
      http://mcpmag.com/articles/2011/07/05/sizing-page-files-on-windows-systems.aspx

  8. SubgeniusD said on August 29, 2011 at 7:51 pm
    Reply

    I have a separate PageFile partition = to Ram (4GB), system managed, with no swap for any of the other drives (partitions) — C (System), Home (Documents) , Applications (non-MSFT). Inspired by Linux partition scheme, works great.

    SmartDefrag 2.2 set to auto-defrag PageFile partition. Just checked, reports 0 % fragmentation.

  9. Jim Fell said on August 29, 2011 at 7:50 pm
    Reply

    It should also be noted that Microsoft uses crash data from the page file to identify problematic drivers and other third-party applications in need of fixing, which can later be patched through Windows Update when a patch becomes available. That is the only reason I still keep the page file on my system, which runs an SSD.

  10. WinCom7 said on August 29, 2011 at 7:24 pm
    Reply

    I really don’t see any point of having a 12GB swap file on a system with 8GB of RAM.
    the whole point of increasing the amount of RAM on a system is to avoid the use of a swap file in the first place.
    I keep my initial size small, say 1024 MB and set the maximum to a large amount (just in case).
    The truth is, that no matter when I look at the Page File size, it has never changed. Not even during playing games that generally require large chunks of RAM.
    Incidentally, I have 8GB of RAM installed.
    Thanks for listening!

    1. Keith Miller said on April 10, 2012 at 7:03 am
      Reply

      I tend to agree; I have just built a system with 32GB RAM, so Windows’ recommended page file size is 48GB! I currently have my page file set to initial size 4096MB with a max of 32768MB. I have also never yet seen it get larger than 4096MB. I can’t afford the disk space to use 48GB for my page file, however, I don’t think that disabling it is a good idea. You can’t assume that every single Windows process is going to function correctly with no page file. I think a small one is better than none. After reading the above link to Mark R’s blog I think my philosophy is in tune with that.

  11. Steve said on August 29, 2011 at 6:42 pm
    Reply

    If you have more than 2GB of ram then just disable the paging file, its very unlikely you will run out of ram unless your doing something super memory intensive. i have six gb of ram and have never run out.

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.