What exactly is virtual memory and why does my computer sometimes run low on it

I have XP, i found this website offered some info.

http://aumha.org/win5/a/xpvm.php

But i still don’t get it. Does running low on virtual memory just mean too many programs are using up too much memory at once? How do you cut down on virutal memory use, just start shutting down programs and restart the computer? Also, how can you find how much memory each program is using? Do you just use ctrl-alt-delete then click on ‘processes’?

XP handles memory well but not that well, certainly not as well as Unix swap. AFAIK it will use all the RAM you can install where Win 98 won’t. Best cure is to buy more memory or run fewer programs, particulartly those that use large data space.

Back in CP/M days virtual memory was a neccessity becauase it wasn’t possible to make a complex program that fit in the 64k memory space. When 8088s and DOS cam along it was possible to use memory as virtual disk space to dramatically speed up some programs that were designed to use virtual memory. For example the overlay files for wordstar that had to be accessed on disk could be put into a ram disk to run fastger. Now we have come full circle.

Physical memory is RAM. Virtual memory is space on your hard drive that Windows sets aside and treats like RAM. In XP, the virtual memory is called the “page file.”

In Windows XP, hit CTRL+ALT+DEL and go to the “Processes” tab. In the “Mem Usage” column, you can see how much virtual memory a process is currently using (or, more properly, the number of pages the process is using). If you look under the “Performance” tab, you can see how much of your page file is being used (“PF Usage”) and how much RAM you have available (“Physical Memory”).

Now, if you’re low on virtual memory, that can mean one of a couple of things:

  1. You don’t have nearly enough RAM, making Windows run almost everything from the page file. XP requires at least 256 MB of RAM, although it won’t really be happy unless you have twice that. So, if you have less than 256 MB, it will have to use large chunks of your page file to compensate.

  2. Not enough page file. If you run a lot of programs at once, or you do a lot of very memory-happy things (like video editing or 3D rendering), you’ll eventually run out of page file space. In XP, this isn’t much of a problem - it will start cannibalizing free space on your hard drive to increase the page file size. If you have the space on your hard drive, then you’ll just have to sit and wait for it to finish.

If you run into “low virtual memory” warnings often, and if you do have enough RAM for XP, then you may want to manually increase your page file size, so Windows doesn’t have to do it for you. The link you provided shows you how.

i have 512MB of DDR RAM, i always thought that that was enough. anyway, there are only 2 slots for RAM and i’m using them both so unless i shell out the $90 for a 512MB stick to replace one of the 256’s then im SOL and i don’t think i’ll do that.

This is completely untrue. Granted, the more RAM you have, the less often Windows needs to access the page file, but XP will still run at an acceptable speed with only 128 MB of RAM. I know this, because my system does, in fact, only have 12 MB installed, is running XP Pro, and runs quite nicely.

“Virtually” all of this is false. Virtual memory was first implemented by Alan Turing in the 1950s. Any significant computing system since then has used it, with one big exception: early personal computers.

The first processors used in early IBM/clone PCs were quite capable of doing paging. Many OSes written for them indeed did do paging. E.g., Minix. But there was no special hardware as was built into later CPUs so it was done with software.

Note that the 8088 was immensely more powerful CPU than what was used in Turing’s Alpha system. Any reasonably smart person can write a virtual memory system for any computer built in the last 40 years.

Note that “DOS” means “Disk Operating System” which of course applies to any OS that uses a disk. So CP/M, Linux, etc. are all DOSes. Note that MS-DOS most notably didn’t do virtual memory in any significant way until later versions of the first MS-Windows line. But it was a poorly done hack, even thru the Win9X line. (That’s right, MS didn’t “get” paging 50 years after Turing.)

There was the short-lived LIMS expanded memory system that allowed early MS-DOS based programs access to more than 640k of memory, but that had nothing to do with actual disk-paging. “Do-it-yourself” disk swapping within apps was extremely uncommon and hasn’t been done it a good long while. Furthermore, that doesn’t count as “Virtual Memory” since it doesn’t rely on transparent-to-the-app memory/disk management.

Moving code and data back and forth between main memory and a disk doesn’t automatically qualify as virtual memory. If apps think there is more memory than there really is, then you have virtual memory. The key word is “virtual”.

In particular “programs that were designed to use virtual memory” is a non-sequitur.

Whoops, mixed up the numbers again. 256 MB is “make Windows happy,” 128 MB is the minimum . Thanks for pointing that out.

I just noticed my massive typo. 12 MB, indeed! Well, you know what I meant. :wink:

Part of the confusion begins with people not beginning with a grasp of the distinction between memory and storage space. If you don’t have that down, virtual memory isn’t going to make much sense either.

Let’s look at one of those early personal computers to which ftg refers.

It has RAM chips, and when the computer is on and running information can be loaded into these chips and it said to be “in memory”. This is not storage space; it isn’t on your hard disk and it isn’t competing with installed programs and document files for available empty megabytes, and if you shut down (or rip the plug out of the wall) the electricity stops running through these chips and whatever information was there in memory goes away like the picture on your TV set when you turn the TV off.

Meanwhile, it also has a hard disk, on which is stored your operating system, your various installed programs, and your document files. This is not memory; in order for your computer to use any of it, it has to be read (copied) into memory. If you have an existing Word document, “Letter to Dad”, and you open it, it gets read into memory, and if you make changes to it and save your changes, it gets re-written to disk based on the copy in memory which includes the changes you made. Your hard disk storage space isn’t affected by how much stuff you try to run at the same time, and if you run out of memory and get an out-of-memory error message when you try to launch Excel after already having Word and Netscape and Hearts Tournament and a dozen other programs open, throwing away a bunch of documents on your hard disk won’t help a bit. What you need to do instead is quit some programs so as to free up some RAM. Inversely, if you go to install a new program and it says you don’t have enough space on your drive, quitting Word and Excel won’t fix the problem.

OK, now jump forward a few years and add in a new complication, virtual memory. Storage space is available in larger quantities than RAM. You’ve got several gigabytes of empty hard disk space but only a gig or less of total RAM, much of which gets filled up by your operating system, the programs you’ve already launched, and the documents of those programs as you open or create them. So…what if we cheat? When you’re in Word, we’ll take a chunk of RAM that’s occupied with bits and bytes of Netscape and we’ll write it to hard disk and clear up that RAM to use for other things, then if you switch back to Netscape, we’ll swap and write a chunk of something else to hard disk and read back the Netscape stuff so you can use it. This is a “swap file”, and our use of it is “virtual memory” — it isn’t real memory, it’s phony memory or virtual memory, it’s really hard disk storage space masquerading as memory.

Thank you AHunter3 … for once I understand *just a little * of what goes on in this chunk 'o plastic on my desk. :slight_smile:

Julie

Virtual memory isn’t just the swap file, it’s the total amount of available memory - your physical memory plus your swap file. If you have 512 MB of RAM and a 512 MB swap file, a program could theoretically allocate an entire gigabyte of virtual memory. (Wouldn’t work in real life, because the OS and other programs need to use some memory too, but you could get close to a gigabyte.)

When a program requests a page of memory from the operating system, it gets a virtual address that can always be used to access that same page, even if the OS moves it around in physical memory or swaps it to disk. Your CPU has a table mapping those virtual addresses to physical addresses, which the OS updates as it moves memory around. When a program tries to access a page that isn’t in the table (because it’s been swapped out to disk), the CPU signals a page fault, which tells the operating system to hurry up and get that page into physical memory so the program can use it.