Windows Swap (Page File): Enable or Disable?

Solution 1:

Windows XP flushes minimized applications to disk like crazy.. try it yourself, start downloading a large torrent and minimize everything. Pretty soon almost all of your RAM is used as file cache for the torrent instead of your other applications. Disabling the page file will prevent this behavior.

In Windows Vista and Windows 7 though, the system handles this scenario much, much better.. so I'm not sure disabling the page file in these versions will do much of a difference.

Some games require you to have a page file even when it's not really needed, I noticed this recently when trying to play a game demo I downloaded from Steam. Even though I had 6 gigs of RAM available the game refused to start until I created a tiny, tiny page file.. sigh

Personally, when I have plenty of RAM, I prefer to go without a paging file.

Solution 2:

Don't mess with it, let Windows figure itself out.

This ServerFault answer is the most excellent explanation of why:

Many people seem to assume that Windows pushes data into the pagefile on demand. EG: something wants a lot of memory, and there is not enough RAM to fill the need, so Windows begins madly writing data from RAM to disk at this last minute, so that it can free up RAM for the new demands.

This is incorrect.

The punchline:

Removing pagefile entirely can cause more disk thrashing.

Solution 3:

from microsoft answer "disable swap file"

http://social.answers.microsoft.com/Forums/en-US/w7performance/thread/0bd8a75c-2607-4468-8342-c35ea82ea670

Ken Blake, Microsoft MVP

is there any performance gain from that ?Thank you.

Can you? Yes. Should you? No, definitely not.

Is there any performance gain from doing that? No, and there's a possible performance loss.

First of all, 2GB is not a lot of RAM, it's the minimum amount that most people should have.

Second, if you don't have a page file, you can't use all the RAM you have. That's because Windows preallocates virtual memory in anticipation of a possible need for it, even though that allocated ay never be used. Without a page file, that allocation has to be made in real memory, thus tying up that memory and preventing it from being used for any purpose.

Third, there is never a benefit in not having a page file. If it isn't needed, it won't be used. Don't confuse allocated memory with used memory.

Ken Blake, Microsoft MVP (Windows Desktop Experience) since 2003 Ken Blake

Solution 4:

I would say enable.

No matter how much RAM you have, there will be scenarios when a page file is, at the very least, useful. Also, it should be noted that when there is a page file, much of the Windows runtime is offloaded there for most of the time. The reason? While it's needed in memory, it isn't needed at the moment. Putting it in the swap file may means it takes longer to access, but it leaves more RAM free for the programs you are actually using.

The reason your performance increased is because you were forcing the whole system to be loaded into RAM, which is admittedly much faster. However, my guess is that when you start using a bunch of programs at once, especially memory-heavy ones like Firefox and your Photoshop, that improvement will go right out the door.*

However, it is possible that you will never encounter that problem simply due to your computing habits. I know that if I tried to turn off the page file, I would not enjoy it one bit. So if you really want to, try leaving it off for a while and see what happens, you can always turn it back on again later.

*"That paragraph was a fair amount of speculation" /disclaimer ;)