Originally posted by: Nothinman
n7, you are correct. If if there is RAM available, Windows will still use its page file if it is enabled.
No, it won't. The accounting provided to taskmgr and perfmon is wrong because it includes pagefile reservations which aren't actually in the pagefile yet and may never be.
You're wrong, it will use the pagefile. Windows constantly tries to keep a certain amount (God only knows how they calculate this) of RAM available for applications to reserve in physical memory immediately. You might recall programs that claim to speed up your PC by 1000% and so forth. Most of these programs do this by allocating RAM and deallocating, hopefully forcing all of the old programs out into the pagefile and leaving fresh physical RAM for new applications to quickly start in. Well, Windows, at least Windows XP does this extensively already so programs like this are virtually useless and would probably do more harm than good (ie: swap more than is needed).
Even a monkey would notice that when they click on applications they haven't used in a while, bits and pieces show up gradually on the screen and the hard drive chugs away. That's because it's been swapped. I've got 2GB of RAM, currently only using 1.21GB, yet 779MB of my swapfile is in use. I have World of Warcraft running in the background, and Windows XP see it fit to allow only 198MB (at one stage it was ~50MB) of the 490MB to be committed to physical memory - the rest resides on the disk. This is mirrored in game, when i run around in the most popular area (with the most textures and models), with the game freezing and HDD chugging as the memory is all swapped back in. However, once this is done, 273MB of physical memory is used. When i open up different applications, even the Start menu, the hard drive chugs along as it swaps everything back in. Open Winamp, same thing. Open a fresh IE, same thing. Chug chug chug. Even with 2GB of RAM.
I'm currently researching this phenomenon, trying to get answers as to how to force Windows XP to not swap so many of my programs (especially system programs) into the pagefile. I have 2GB of RAM and a 768MB pagefile, and Windows even warns me sometimes that it's increasing the pagefile and that some applications may fail, even when only about 1GB of RAM or less is in use. I don't believe i have a virus or trojan on my computer. I have no spyware and none of those "speed-up" programs installed. There's no reason why Windows should swap so much of my physical memory. Yet it continues. My only solution seems to be to set the pagefile to 2MB min, 2MB max. This is the minimum and will at least allow BSOD crash dumps (not that i get any) to be logged so i can later WinDbg them.
The same thing happens on my wife's computer. She only has 1GB, runs World of Warcraft in low quality mode (uses around 300MB or so), and frequently has the freezing problem where Windows swaps all of your pages back into physical memory, causing her to fall off paths and so forth in the game while the HDD chugs for about 5 seconds. She runs maybe 1 or 2 MS Word instances in the background, 10-20MB each. There's no reason why her computer should suffer "swappage" either.
On the lighter side, i have a Linux box that runs a web, mail, and file sharing server which doesn't use the swapfile at all. This is obviously where your experiences lie, and you have little experience or knowledge of how Windows swaps.
Any comments or ideas would be appreciated as to the original posters idea of disabling the swap file (or at least limiting it to 2MB), and also as to how to tweak Windows XP's handling of the pagefile and free physical memory (through the registry perhaps?).
Regards.
Edit: By the way, an easy way to see a (not always accurate) figure of how much RAM a program is using and how much of it is in physical memory is to use Task Manager. The "Mem Usage" is the Physical memory in use, and the VM Size is the total space allocated by the application. Sometimes for some reason the Mem Usage is higher than the VM Size, i don't know what's up with that, but you get a rough idea. Also, this is a great way to see how Windows XP swaps your stuff into the pagefile. For example, right now, MSN Messenger shows 5.7MB Mem Usage, 32.3MB VM Size. But i'll just open MSN up, fire up a conversation window, and watch (as Task Manager is on top) the Mem Usage rise to... 23.1MB, my HDD chugging like a ah heck the meantime. It took around 4 seconds for MSN to popup while the HDD chugged. YET I HAVE ONLY 1.22GB in use and 2GB of RAM and only a few small applications open and a 500MB game! Why Windows? Whyyyyyyy?