Virtual Memory

Category: Apple-Mac , Memory , Windows

What's the difference between virtual memory and real memory? And how can I add more virtual memory to my computer?

What is Virtual Memory?

There's a lot of talk about all things virtual these days: virtual servers, virtual storage, virtual desktops, and so on. Memory can be virtualized as well. So what is virtual memory? When all the programs running on your computer consume the real physical memory (RAM) on your motherboard, your operating system will grab a chunk of unused hard drive space and create virtual memory. Your software can't tell the difference between real memory and virtual memory. The only practical difference is that RAM (real memory) has a much faster access time than a hard drive (virtual memory).

Why is virtual memory useful? Well, unlike physical memory, virtual memory is free and relatively unlimited, as long as you have a few gigabytes of free space on your hard drive. It's a very efficient way to extend the capacity of physical memory. Even though virtual memory is not as fast as real memory, it's better for your computer to manage virtual memory behind the scenes than to say "Sorry, memory is full. Please close one program before opening another."
Virtual Memory

So how much virtual memory is on your system? The general rule of thumb, at least on Windows-based computers, is for virtual memory to be about 1.5 times the size of the physical memory. But, the more physical memory you have the less virtual memory will need to be used. Here's an example: Let's say you have 2 GB of RAM, and after booting up your computer, and opening your browser and email program, the amount of real memory in use is only 1.8 GB. Your computer will not be using any virtual memory at that point. But suppose you then launch your video editing program and open up a couple of high-res video clips. Now your computer needs 3.4 GB of memory to keep all the balls in the air, so 2 GB of real memory, plus 1.4 GB of virtual memory will be required. If you kept all those programs open and then launched another memory-hungry application, you might approach the combined amount of real plus virtual memory that's available. Only at that point would you see an "Out of Memory" or "Low Virtual Memory" message from your computer.

Increasing Virtual Memory

If you find that you're taxing your memory to the limits, there are ways to increase the amount of virtual memory available. In Windows, virtual memory is known as a pagefile, or more specifically, the file named pagefile.sys. Virtual memory settings can be tweaked within the operating system. In Windows XP, go into the Control Panel, then System, and click the "Advanced" tab. Click on the "Settings" button under the "Performance" heading. Then click on the "Advanced" tab under "Performance Options". Under the "Virtual Memory" heading, you'll see the "total paging size" listed -- this is the amount of virtual memory currently available. Click on the "Change" button to modify your virtual memory settings.

Virtual Memory Settings - Windows XP

In the above example, the system has 2046 MB of virtual memory at startup (the initial size) and will expand to a maximum of 4096 MB. You have three choices for configuring your virtual memory. The simplest is to select "System managed size" and just let Windows control the amount of virtual memory as it sees fit. You can also select "Custom size" and enter your own initial and maximum size values. My recommendation is to set both values at 1.5 or 2 times the amount of real memory. So if you have 2 GB of RAM, you might enter 3072 for the initial and 4096 for the maximum size. (Remember that 1000 MB is one gigabyte.) Your third option is to select the "No paging file" option. Do this only if you have lots of RAM, and you're sure that you'll never need to use virtual memory.

You can customize the pagefile the same way in Vista. However, Vista has an even better way to increase virtual memory. ReadyBoost is a new technology in Vista that uses flash memory to increase system performance. Plus, it's easy to use. Simply connect a USB 2.0 flash drive to your machine. An AutoPlay windows will pop up, showing that Vista sees a Removable disk has been added to the system. Click on the "Speed up my system" option. Select the "Use this device" option when the ReadyBoost configuration page opens. Adjust the slider to set the amount of space you want to use. See the companion article Vista ReadyBoost for more information.

Virtual Memory Efficiency

Technology professionals (read: geeks like me) will sometimes recommend that you move the pagefile.sys file to a separate disk from the one on which Windows is installed. The idea is that your multi-tasking operating system may be able to access the virtual memory faster if it's on a dedicated hard drive that's not busy doing stuff with programs or files. It may also reduce pagefile fragmentation, which will improve the efficiency of reading and writing virtual memory on the disk. Note that moving it to another partition on the same drive will not make a difference. To have any impact, the pagefile should be moved to a separate physical hard drive. To move your pagefile, use the Virtual Memory settings dialog discussed earlier. Select the drive where you want your pagefile to reside, and set the initial and maximum sizes as desired. Then select the C: drive, and change the initial and maximum sizes to 126MB. (You can make it smaller, or even choose the "No Paging" option, but the system will not be able to create a log file if a system failure occurs.) You'll have to restart your system for the changes to take effect.

Mac OS X can also be tweaked to optimize virtual memory. The best way to do this, is maximize the amount of physical RAM in the system. Mac OS X can efficiently handle the allocation of virtual memory without too much user interference, provided there is a sufficient amount of physical memory. The "swap" file is the Mac OS X equivalent of the pagefile in Windows. The swap file can also be moved to a different drive in Mac OS X. See this Mac OS X Hints article for details.

Running Linux? One of the advanced setup options when installing Linux is where to put the swap file. You can also change the location of your Linux swap file. See this nixCraft article for help with that.

Of course, not using virtual memory at all (or as little as possible) would be the most efficient option. And to do that, you'll need to install the maximum amount of physical memory that your system can handle. See Adding Memory for information on finding out how much RAM you have, and how to add more.

Your input is welcome! Post your comments and questions below...

Ask Your Computer or Internet Question

  (Enter your question in the box above.)

It's Guaranteed to Make You Smarter...

AskBob Updates: Boost your Internet IQ & solve computer problems.
Get your FREE Subscription!


Check out other articles in this category:

Link to this article from your site or blog. Just copy and paste from this box:

This article was posted by on 15 Dec 2008

For Fun: Buy Bob a Snickers.

Prev Article:
Watch Television on Your Computer

The Top Twenty
Next Article:
Free Registry Cleaners

Most recent comments on "Virtual Memory"

Posted by:

Richard Kavanagh
16 Dec 2008

I agree with Bob that moving the pagefile to another disc helps but I suggest that instead of setting the pagefile size to zero on disc C:, you set it to something small like 50 Megabytes. You should notice an increase in performance.

EDITOR'S NOTE: Point taken. I've updated the article to indicate a suggested size of 126MB, which MS recommends to ensure that a debug file can be created if a STOP eror occurs.

Posted by:

Dotan Cohen
22 Dec 2008

1024 MB is one Gigabyte. Don't oversimplify.

EDITOR'S NOTE: I *wish* it was that simple! According to WIkipedia, the term "gigabyte" is ambiguous. Most commonly in recent years, 1 gigabyte (GB) is considered equal to one billion bytes. But some people use the binary value (1024 megabytes) when referring to RAM, and the decimal value (1000 megabytes) when referring to hard disk sizes. Since 1999, the IEC has been recommending that the correct term for 1024*1024*1024 bytes (1.073 billion bytes) should be called a gibibyte (GiB) instead of a gigabyte. Fortunately, the difference between the two values is pretty small!

Posted by:

Stu Berg
23 Dec 2008

I learned that using the following procedure permanently prevents paging file fragmentation:

1. Choose "No paging file" and then reboot.

2. Then set the initial and maximum paging file size to the same value (i.e. 1.5 or 2 times the physical memory size).

This procedure sets up one contiguous space for the paging file that the operating system can't change because it is constrained by the initial and maximum sizes being the same. Thus, fragmentation is permanently eliminated.

Posted by:

12 Jan 2009

Well, I still believe we should stick with 1GB=1024MB to avoid confusion. The move towards 1GB=1000MB (and 1MB=1000kB) is probably because people seem to be lazy to be properly educated these days. I compare this to that small portion of the world that insists on calling gasoline "gas" when this "gas" is actually a liquid, not a gas, ie; a vapor. Either call it petrol or gasoline, but to shorten it to "gas", what then to call gas (as in natural gas)? Nat gas? That's dumb.

EDITOR'S NOTE: I suppose it never occurred to you that "petrol" is an abbreviation for something...?

Posted by:

20 Jan 2010

So a quick question...I need to run a gps map update that says it requires 1GB of RAM. My machine has 512MB of RAM (with about 193 available) and about 2GB of Virtual Memory. SInce the Virtual Memory exceeds the requirement can I run the update?

Posted by:

13 Aug 2013

If I use my pen-drive as RAM for my PC can I remove it or is it necessary to use as RAM permanently.Can I use my pen-drive for for other purposes

Posted by:

sbobet indonesia
17 Sep 2014

My brother suggested I would possibly like this website. He was totally right. This publish actually made my day. You cann't imagine simply how so much time I had spent for this info! Thanks!

Post your Comments, Questions or Suggestions

*     *     (* = Required field)

    (Your email address will not be published)
(you may use HTML tags for style)

YES... spelling, punctuation, grammar and proper use of UPPER/lower case are important! And please limit your remarks to 3-4 paragraphs. If you want to see your comment posted, pay attention to these items.

All comments are previewed, and may be edited before posting.

NOTE: Please, post comments on this article ONLY.
If you want to ask a question click here.

Free Tech Support -- Ask Bob Rankin
RSS   Add to My Yahoo!   Feedburner Feed
Subscribe to AskBobRankin Updates: Free Newsletter
Copyright © 2005 - Bob Rankin - All Rights Reserved
Privacy Policy -- See my profile on Google.

Article information: AskBobRankin -- Virtual Memory (Posted: 15 Dec 2008)
Copyright © 2005 - Bob Rankin - All Rights Reserved