Technology in terms you understand. Sign up for my weekly newsletter, "Confident Computing", for more solutions you can use to make your life easier. Click here.

What is Virtual Memory?

//

What is virtual memory?

There’s memory and then there’s disk space. There’s memory that’s on disk, not to be confused with memory that looks like a disk. Disk that looks like memory? Isn’t the disk a kind of memory? Or is it something else?

It’s very confusing, but we can clear a few things up. Disks and memory are fairly easy. Virtual memory is one way that they overlap; with a little explanation, we can make that a little less confusing, too.

Become a Patron of Ask Leo! and go ad-free!

(Note: The sizes of RAM and hard disk mentioned below may seem small by today’s standards, but the concepts definitely still apply. No matter how much RAM or disk space becomes commonplace, we always seem to want more. Smile.)

First, let’s review the basics: memory versus disk space.

When a computer geek like me (or a computer salesman not like me) talks about computer memory or RAM (for Random Access Memory), we’re talking about a bunch of silicon chips in your computer that hold things like the operating system, the programs that you’re actually running right now, the document currently showing in your word processor, or the email that you’re typing up. Computers these days typically have somewhere between 128 megabytes (128 million bytes) and 4 gigabytes (4 billion bytes). What’s important is that when you turn the computer off or if it crashes – *poof* – anything stored in RAM is gone. That’s why when you’re editing a document, it’s a good idea to save to disk often.

When we talk about disks, we’re talking about the hard disk drives in your machine. Quite literally, a hard disk drive is typically made of several metal disks coated with a magnetic material not unlike a video or audio tape or the strip on the back of a credit card. The disk spins at a fairly high rate of speed and special “heads” can read, or record, a pattern of bits (ones and zeroes) on the magnetic surface. The operating system assembles those bits into bytes, and the bytes into the files that you might save, receive, or create. Disks do not lose what’s on them when you turn off the power. Typical disk sizes these days start in the 20 to 40 gigabyte range and go as high as 250 gigabytes. It won’t be long before we see the next step, the terabyte (one trillion bytes), on a single disk.

Compared to memory, disks are much slower. Too slow in fact for your computer to work from directly. So the typical sequence of events is to load your program or document into memory from disk, have it run, or be worked on in memory, and then either remove it from memory if it hasn’t changed or save any updates back to the disk.

Virtual memory is simply the operating system using some amount of disk space as if it were real memory.

Exactly how virtual memory is implemented is complex and well beyond what I’d want to present here. But in an over-simplified nutshell, it works like this:

  • You run programs that need memory. The operating system takes care of tracking which program is using what portions of memory and allocating each program the amount of memory that it needs.
  • Those programs will need more memory as they do their jobs. Opening a large document may cause your word processor to request additional memory from the operating system in order to hold the document.
  • If there isn’t enough memory available to satisfy a request, the operating system may decide that another program’s needs are less “important.” Some of that program’s memory will be freed, first by writing the contents to disk (the memory is
    “swapped out”), and then allocated to the program making the request.
  • Later, when the program whose memory was swapped out needs it back, that memory can be “swapped in” by reading it back from disk. This might cause memory from another program to be swapped out to make room.

Also remember that the operating system itself is also just a program. So it will have need for memory, too. It can allocate memory to itself and its memory may get swapped out to disk as other needs arise.

As I said, disks are slower than memory, so if the operating system is doing a lot of swapping between the two, it’s going to slow your computer down. If that’s happening frequently or if your computer seems to be “thrashing” or constantly swapping in and out from disk, then it might be time to add some memory to your machine. It can be one of the most cost-effective ways to increase your system’s speed.

53 comments on “What is Virtual Memory?”

  1. suject virtual memory hope i can express myself will enough. well on this lets say i have 60 rams of memory when i shut down from cleaning up process then when i come back on the rams says 54 what is happening; what can i do to help this stop and is there any thing i do to clean out my rams or virtual memory; how can i bring up the virtual memory to read it to remove any thing i want to remove could there still be some old vireus’s that are in the hard drive that didnot real get removed that got hidden from me or could i of not reconizied the vireus’s couse of the way they where written out in the files how do u pull up these files; how do i pull up files written to hard drive so i can remove; is there any thing i can do to keep my rams up at ia high level is there a way to permently save data on pc’s without it missing up memory. is there a way to save it as not to lose it? please e-mail me to answer me

  2. I keep on getting an error saying that my virtual memory is too low. But I checked the space that is left on my C drive and it’s saying that I have plenty of free space. I have a laptop computer. Do I need to buy more memory for it? And if so, how would I install it?

    please help!

    thanks

  3. Leo, I am operating the windows 2000, and last week got DSL, and it was a lot faster for a few days, now as I did before but not as much am getting the message YOUR VIRTUAL MEMORY IS LOW,this is happening quite often. My computer has also slowed, and it seems I am running dial-up again, what do I need to do about this problem?
    Thanks for your help- carl

  4. leo, how can i create space in memory and store the content of my pc into that without consuming much space in hard disk for BACKUP purpose. something like creating virtual memory in hard disk.

    Thank you

  5. Leo, please can u tell me how can i restore back or increase my virtual memory and i have try everythings and nothing works, please can u help me, thanks.

  6. I’m away from my Windows 2000 machine, but if I recall correctly it’s similar to WinXP: right click on My Computer, select Properties, select the Advanced tab, under Performance, click the Settings button, click the Advanced tab, in the Virtual Memory section click the Change button.

  7. in relation to increasing virtual memory, once you have done the above refer posting dated 26th october 2004 9.05am. In the custom size what figures should be in the minimum and maximum for eg paging file siZe

  8. Hi Leo,
    I’ve a question. Before that this is abt my system:
    Intel Celeron 800 MHz and 256Mb RAM with Windows XP home

    I am having problem with my pc for past 2 days. previously it was working fine but now its like some 486 machine. It takes forever to do anything. I mean its almost hangs everytime. e.g. if I start a movie in realplayer it will take almost 3 minutes to start the movie. Then, if I try to switch bet. windows in IE then it will take another forver.

    And the CPU always runs at almost 100% with a single application like realplayer.

    The I tried to increase my virtual memory from the recommended 382MB to 512 Mb with a max of 1GB. I thought this would improve the performance. But nothing happened.

    Could you help me in this regard ? I mean to make the comp a little faster from now like 486 to the original celeron.

    Thanks in advance,
    Kaushal.

    PS. I’ve tried Ad-ware and Spybot to check if there is no spyware in my comp or some redundant processes that might slow the comp, but it has only 19 processes when nothing is being done.

  9. Hi,

    Is there a way of setting the virtual memory limit past the 4gb limit on Windows 2000 Server.
    This is needed for a very resource intensive application.

    Thanks in advance

    Andy

  10. i have an intel celeron 432mhz,10gb with 56mb or ram,well i was thinking of increasing the ram but am afraid it can mess up the whole system,coz i have tried it with hp and the computer didn’t even start,so please leo,just try to help me teach me how i can increase my ram so that i can run win 2000 on my pc am missing the features of 2k.thanks in advance

  11. How you do it depends entirely on the manufacturer of your computer and the motherboard that they used. I’d get in touch with the manufacturer for specific instructions for your machine.

  12. Hi Leo, need a big help here. I formated 40G new hard drive and the size became smaller to 8G. I wonder why, please help me. Is there any way to re-format the 40G hard drive to stay 40G instead of 8G? Thanks in advance, Al.

  13. My hp 1502 computer is low on virtual memory. For this reason my computer gets freeze every after 10 minutes. Can you pls help me in the process of increasing the virtual memory on my system?

  14. is there any way to increase my ram for free?
    can i delete programs to get more ram?
    i have a game called half life 2 and counter strike source i need atleast 256mb of ram i ogt 224
    i hope u can find me a way to increase my ram for free

  15. No, the only way you can get games running acceptibly is to really have AT LEAST the minimum amount of RAM in your system. Preferrably a lot more.

  16. i found out that i had 256 mb of ram 224 of memory and 32 of video memory
    i dont think the game doesnt work cuz of my ram
    how do u check whats ur graphics card

  17. Hey Leo, I have a Compaq Presario V2029AP Notebook with a 1.6Ghz Pentium M Centrino Processor, 768MB of RAM 64 of which is allocated to graphics, I have a game i wish to play which requires 512MB of RAM and 128MB graphics, is there a way i can allocate more of my RAM to the integrated graphics? I don’t need all my RAM and it would be convinient to have more graphics.

  18. It’s highly unlikely. Normally that’s fixed by the video adapter. However I would check with Compaq to find out the specific capabilities of the specific graphics adapter installed in your machine.

  19. Hi Leo how are you doing today hope everything is well-i have a compaq armada 1750 and it keep saying that i need more Virtual memory,i want to know where can i get some memory and do you know how much.thank leo.

    Lamont Adams

  20. Yea hi iam running games like half life 2, battlefield 2, F.E.A.R. and doom 3 on my pc. When i go to a test my pc site it says that all my specifications are good exept for my virtuel memorie and my ram, Is there any way i can increase this.

  21. Hey Leo,

    I have about the same question as Jason. I was wondering if there was any way at all to get more MB of RAM. Because I’ve heard somewhere that you can somehow “tweak” your computer to get more, but I’m a bit skeptical about it. My computer only has 124 MB of RAM. Some of my games require a lot more that this. I meet all the other requirements but it’s the RAM that kills me.

    If you’re truly sure that there is no way to increase it the way it is please say so. Other than me going out and buying things to increase it, is there any other options to increase it?

  22. hi Leo,
    I seem to have malware in my virtual memory and i have tried various programs to remove it, the best has been ewido,it recognizes it but there is an error during cleaning. I was wondering if you might know of any other programs that might be able to specifically target malware in virtual memory

    Regards Josh

  23. please help me .
    i want program(code) for virtual memory using programming language .
    please send me quickly.
    thank you very much.

  24. LEO,
    I HAVE AN OS 2000NT AND RUNNING BIG PROGRAMS ON LINE,I AM RECEIVING THE LOW VIRTUAL MEMORY MESSAGE WHEN WORKING AT ON-LINE TRAINING.I HAVE TRIED TO INCREASE MY PC’S VIRTUAL MEMORY BY GOING THROUGH THE PERFORMANCE SETTING, BUT EVERY TIME I CHANGED MY INITIAL AND MAXIMUM SIZE, THE CHANGES DID NOT TAKE EFFECT EVEN THOUGH MY C DRIVE SPACE AVAILABLE IS 10003MB.PLEASE ADVISE ME AS SOON AS YOU CAN. I MUST ADD THAT, MY CURRENT REGISTERY SIZE IS 18MB AND MY MAXIMUM REGISTERY SIZE IS 35MB ONPAGING FILE SIZE FOR SELECTIVE DRIVE C.

    THANKS
    DR. MARANDI

  25. Leo,

    If I increase my RAM, will I then be able to increase my virtual memory? I am trying to save a large movie file to a CD, evertime I get just about to the end of the movie the message increasing virtual memory comes up, my CD will finish, however just the music portion of my movie finishes and some of the pictures at the end are lost.

    Thanks,

    LT

  26. Hey Leo,

    I have a question; I recently upgraded my computer’s memory to 1.50 Ram of memory from 1Ram. So, said that, I was checking on my Virtual Memory and it was set to 1536 Initial size and to 3072 Maximum size but, down below that it said that the recommended paging size should be set to 2299 so, I did it.
    Now my question is; “was it good to change it or should I change it back to what it was..??

    Please advice Leo and if you can e-mail me the answer as well, I will totally appreciate it.

    Thank you!

    Favio.

  27. Hey leo,
    is there any effect if your computer has a low virtual memory?

    Your computer will slow down, and it’s possible that some software may eventually fail.

    – Leo
    23-Nov-2008
  28. On the HP Pavilion a810n it came with 512mb memory. I bought a 1 gig stick with the same specs. When it comes can I install it with the smaller stick or does the 512 stick have to be removed? Also shoulf the 1 gig stick go into slot 1 and 512 mb go in slot 2?
    Thanks

    You need to check with HP – what you need to do and what you can do vary depending on the specific computer.

    – Leo
    29-Jan-2009
  29. why cant we store the physical addresses directly in the disk. why we create virtual addresses. it may look stupid but i just want to know things more clearly.

  30. Virtual memory is a very confusing subject for most computer users, and this is due in part to Microsoft’s hopeless descriptions. Notably the persistent references to virtual memory as the pagefile. That may have been true for Wndows 3.1 but virtual memory is much, much more on modern systems. This belief has been the cause of enormous confusion, even among many computer professionals.

    Virtual memory is a system that provides a virtual environment to applications that is independent of the computers physical resources. Each application has a 2GB private and unshared address space. There is also a 2GB space for system use that is common to all applications. This is totally independent of how much RAM is in the system.

    Aplications know only the virtual address space, they have no direct access to physical memory. The system maps physical memory to this virtual address space according to both need and availability. Portions of an application will be in the original files, the pagefile, or RAM. This managed by the system and is transparent to applicatons. The system will attempt to keep as much of the recently accessed data and code in RAM as is possible. The remainder will be on disk.

    The virtual memory system can function without a pagefle but efficiency will be impaired. Application code is not normally copied to the pagefile as it can be reloaded from the original files if needed. Only modified data will be paged to the pagefile. With no pagefile only program code can be paged, thus unbalancing the system and leading to performance degradation.

    Larry Miller
    Microsoft MCSA

  31. [ilnk removed]
    The above link is a step by step guide on How To check your Computers Memory to see how much space you have used and how much is left.

    I’ve removed the link because the article in question isn’t talking about memory at all, but disk space.

    Leo
    04-Mar-2010

  32. what is rite amount for virtual memory for compaq presario? intital size (mb):670. and maximum size(mb): 670 ??? or more ? for C:[PRESARIO]? THANKS…

    There is no “right size”. It depends on how much memory you have, and how you use your computer. The right size is different under different circumstances.

    Leo
    05-May-2010

  33. virtual memory is a conseptually somewhere between RAM and Hard disk space;it’s disk space used to maximize the amount of RAM available to progarm.

  34. virtual memory is a memory that the processor has been “tricked” into using as if it were actual physical memory……….

  35. Virtual memory satisfies the emergency memory requirement of a process presently running on your computer system,all works are done via OS. In process execution time address binding scheme results in different logical and physical address,in this case we usually refer the logical address as vitual address and this address(pages) are usually belonging from hard disk.

    sudip Sahoo(Master In Computer Application student)

  36. PHEW! heavy duty stuff. All I know is buy a memory USB flash 4gigs format to increase ram when prompted. I’m running(away from Windows 8) on a note book with only 1GHz of muscle. UBUNTU here I come.

Leave a reply:

Before commenting please:

  • Read the article. Comments indicating you've not read the article will be removed.
  • Comment on the article. New question? Start with search, at the top of the page. Off-topic comments will be removed.
  • No personal information. Email addresses, phone numbers and such will be removed.
  • Add to the discussion. Comments that do not — typically off-topic or content-free comments — will be removed.

All comments containing links will be moderated before publication. Anything that looks the least bit like spam will be removed.

I want comments to be valuable for everyone, including those who come later and take the time to read.