Home » Questions » Computers [ Ask a new question ]

Windows Swap (Page File): Enable or Disable?

Windows Swap (Page File): Enable or Disable?

From my personal experience I've noticed that disabling the page file in Windows XP has given me, in general, the most speed gain out of any other software change I can make. Obviously this has to be done when a significant amount of RAM is available. Typically I find that it works nicely with +2GB of RAM. The only issues I've ever really had were loading up Adobe Photoshop.

Asked by: Guest | Views: 90
Total answers/comments: 5
Guest [Entry]

"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."
Guest [Entry]

"from microsoft answer ""disable swap file""

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
Ken Blake, Microsoft MVP (Windows
Desktop Experience) since 2003 Ken
Guest [Entry]

I disable the swap file on 32-bit Windows systems with 4GB of physical memory. Having virtual memory on isn't going to add any more addresses to the system, and having it off means I never have to wait for Windows to swap in or out.
Guest [Entry]

"I disable the swap file on 32-bit Windows systems with 4GB of physical memory. Having virtual memory on isn't going to add any more addresses to the system, and having it off means I never have to wait for Windows to swap in or out.

No. Address space is as follows:
every PROCESS has its own 31-bit address space (lower 2GB) and kernel has its own 31-bit address space (always same, regardless of which process owns current thread). This gives you 2GB * number of processes of available user-mode address space. Without a swap user-mode space is limited to physical memory size minus kernel memory size (usually around 200 MB).
Of course, there may be some artificial limit on how much virtual memory your system can allocate, but I'm not an expert in Microsoft's licensing policies.

Also, note that disabling swap does not necessarily mean that there will be no page-faults resulting in disk access. The swap file is not the only file that memory is mapped to. Every executable file (that is, .exe or .dll, except kernel mode drivers) has its own disk backup - namely, the exe file. Of course, pages that have been modified in-memory, such as writable data segments, IAT, or even code segments (in case of packed executables, for example) need separate swap-backing, but vast majority of code/static data/resources do not need swap and... can be removed from memory when system is low on resources. When the process needs an access to such data, page fault and disk access will occur, whether swap is enabled or not."
Guest [Entry]

"Sean Nyman previously said ""especially memory-heavy ones like Firefox and your Photoshop, that improvement will go right out the door.""

I just wanted to add that in Firefox, if you type about:config into the address bar to go to the advanced settings in Firefox, you can add a new string for browser.cache.disk.enable and set the boolean value to false and this will force Firefox to cache only to RAM. You can also add the string browser.cache.disk.capacity and specify a value to control how much space in RAM Firefox will use for the browser cache. I hope this helps. I have mine set to cache in RAM and Firefox is always super fast.

I also have an SSD drive for the system drive in this laptop, with a 500GB rotary drive in the secondary bay for storage, and I set the TMP, TEMP, and Temporary Internet Files folders to point to the rotary drive in Windows 7 Pro, along with moving my pagefile.sys over to my rotary drive on D: and my system works very fast like lightning. I have 4GB RAM anyway, so I don't think Windows 7 even uses the pagefile much, but what is the harm in leaving it turned on?"