Running XP with the pagefile disabled

October 19, 2005

If you have 2 gigabytes (or more) of memory in your PC, have you considered turning off your pagefile? Here's how to do it:

  1. Control Panel, System
  2. Advanced tab
  3. Performance group, Settings button
  4. Advanced tab
  5. Virtual Memory group, Change button
  6. Select "No paging file" and click Set, then OK.

Windows XP virtual memory settings dialog

I've heard people talk about this before, but I had always disregarded it as crazy talk. The pagefile is a critical part of the operating system:

The paging file (pagefile.sys) is a hidden system file that forms a key component of the Virtual Memory Manager (VMM) on Windows platforms. The origin of this file dates back to early 1990s when Windows ran on PC hardware that had limited physical memory due to the high cost of RAM and the limitations of motherboard design. (The concept of virtual memory itself, of course, is much older.) The purpose of the pagefile was to allow memory-hungry applications to circumvent insufficient RAM by allowing seldom-used pages of RAM to be swapped to disk until needed (hence the term swapfile used on earlier Windows platforms). For example, if a Windows 3.1 machine had 8MB of RAM and a 12MB permanent swap file (386spart.par) on its C: drive, then the effective memory that applications could use was 8 + 12 = 20MB.

This idea was indeed crazy in a world where 256mb, 512mb and 1gb of memory were the norm. Now that 2 gb of memory is relatively common, disabling the pagefile isn't such a crazy idea any more.

A number of developers are already running their systems with the pagefile disabled, as this post by Peter Provost illustrates. Clearly it works. I've been running this way for a few days, and I haven't encountered any issues yet.

However, I'm not so sure there's any practical performance increase from disabling your pagefile. If our systems were never running out of physical memory with 2gb, then theoretically the pagefile never gets used anyway. And disabling the pagefile also introduces a new risk: if an app requests more memory than is physically available, it will receive a stern "out of memory" error instead of the slow disk-based virtual memory the OS would normally provide. This Q&A outlines the risks:

So, if you have a lot of RAM, you don't need a pagefile, right? Not necessarily. When certain applications start, they allocate a huge amount of memory (hundreds of megabytes typically set aside in virtual memory) even though they might not use it. If no pagefile (i.e., virtual memory) is present, a memory-hogging application can quickly use a large chunk of RAM. Even worse, just a few such programs can bring a machine loaded with memory to a halt. Some applications (e.g., Adobe Photoshop) will display warnings on startup if no pagefile is present.

My advice, therefore, is not to disable the pagefile, because Windows will move pages from RAM to the pagefile only when necessary. Furthermore, you gain no performance improvement by turning off the pagefile. To save disk space, you can set a small initial pagefile size (as little as 100MB) and set a high maximum size (e.g., 1GB) so that Windows can increase the size if needed. With 1GB of RAM under normal application loads, the pagefile would probably never need to grow.

This is one case where the 32-bit process memory limit of 4 gigabytes -- which is really 2 gigabytes once you factor in the Windows kernel memory split -- works in our favor.

Posted by Jeff Atwood
70 Comments

The classic problem with not having a page file is that the commit kills you.

For many kinds of memory allocations, windows commits to providing the memory asked for, meaning that if the program really goes and touches all the pages that it asked for, the system will be able to provide the memory.

With a page file, this is easy - it merely has to make sure it never commits to more than the sum of the physical memory plus the page file size.

Without a page file, it can never commit more memory than you have physical memory.

Why's that a problem? Well I was told by a guy I know who years back used to work for SCO (remember when that was a brand of UNIX, rather than a lawsuit factory?) that the OS typically needs to commit a whole lot more than is normally used.

So the net result is that turning off the page file means that 10-20% of your memory goes unused because the OS had to commit it just in case the application used all the space it asked for.

However...

First, I'm not sure if the commit:actual usage ratio in Windows happens to match the circa 1990 ration in SCO Unix.

But more importantly, Windows is able to use memory which is technically committed but not actually in use. It uses it it in at least two ways. First, when DLLs get unloaded, the memory they used goes onto the free list, but the OS tracks the fact that the memory still contains the DLL image. (Unless the memory ends up being used, in which case it gets zeroed and then moved out of the free list...)

Second, this committed but unused memory can be used for the filesystem cache. SCO UNIX couldn't do that. (Or at least it couldn't back in 1990.) File system caching was done in a fixed-size preallocated chunk of memory.

The file system cache is a pretty significant performance feature, and in practice, I would expect it usually uses a much higher proportion of your memory than the committed-but-unused memory. (Right now, my filesystem cache has about 1GB in it!)

So in practice, the classic concerns about why you need a pagefile to get the most out of your physical memory probably no longer apply.

The possible exceptions you describe would correspond to an abnormally high commit : used ratio.

Ian Griffiths on October 20, 2005 7:16 AM

I don't see any benefit - only risks. Sure, the stuff that gets pages out because I never use it might load faster, if I need it. But wait, I never need it. Oh well.

What this says to me is that by forcing the OS not to page anything out I'm therefore dedicating part of the physical RAM ($200/GB) to it instead of using disk ($1/GB). Not to mention the hard limit of 4GB of RAM, while I have 1.3TB of disk. And the free bonus offer with this is that it might make my system less stable, and some programs might crash more often.

In my case I actually use the 2GB I have - I run 7z with the 128MB dictionary (uses 1.3GB of RAM when compressing, 128MB decompressing), as well as Photoshop (which would like more than 2GB if I had it) and a couple of DB apps (which again would like more than 2GB). Bring on the AMD64 motherboards and OS that take 8GB or more.

Moz on October 20, 2005 8:14 AM

So in practice, the classic concerns about why you need a pagefile to get the most out of your physical memory probably no longer apply.

This is what I am thinking too.. although not having a pagefile may end up being a negligible perf benefit. I have yet to see anyone show any hard data on this, other than "look ma, no pagefile!"

It is cool though. ;)

I don't see any benefit - only risks.

Yes, but some of these risks are getting fairly theoretical. I say try it and see what happens.. breaking stuff is FUN!

I run 7z with the 128MB dictionary (uses 1.3GB of RAM when compressing, 128MB decompressing)

And you get, what, maybe 0.005 better compression from this? I've experimented with the 7zip "ultra" setting and it's always a tremendous disappointment. Way, way more time spent for a tiny, tiny fractional improvement in compression over "normal":

http://www.codinghorror.com/blog/archives/000313.html

Jeff Atwood on October 20, 2005 8:50 AM

I routinely disable the pagefile for all of my computers and fresh installs, even for machines with as little as 512Mb of memory.

*Theoretically*, Windows should move pages to the swapfile only when needed, but the apparent reality is that Windows will move pages from applications that have have been unused for a while, even if memory isn't scarce.

You can try this yourself: open up a bunch of applications, then walk away from your computer. Return after a few minutes and then click each taskbar icon in turn. Watch Windows thrash.

On the other hand, disable the page file, and your computer will remain responsive at all times. And, being a power user, I'd rather have an "Out of memory" error, telling me that I'm overloading my system, which I shouldn't be able to get away with even if I can't see it because of the pagefile. Not that I ever got that message -- I haven't had a single problem yet since running without page file, and that's for about a year now.

Bottom line: I'd rather have a more responsive computer, so no pagefile for me.

RiX0R on October 20, 2005 10:52 AM

I run 7z with the 128MB dictionary (uses 1.3GB of RAM when compressing, 128MB decompressing)

Ok, so I tried this on the VMWare "Browser Appliance" image files (817mb):

http://www.vmware.com/vmtn/vm/browserapp.html

winzip max portable -- 206.6mb

This was EXTREMELY fast. Around 3x faster than 7zip normal.

7zip normal -- 145.9mb
7zip ultra -- 135.2 mb (-7% size, 2x time)
7zip "hyper" -- 131.3 mb (-10% size, 5x time)

"hyper" used the settings you listed and took 1.2gb of memory while compressing and actually did cause me to get an out of memory error in other apps (!)

Jeff Atwood on October 21, 2005 4:45 AM

Who cares if it takes 5 hours to do it? I have spare machines at work for that

Then you shouldn't care if the paging file is disabled on *your* box, right? ;)

Jeff Atwood on October 21, 2005 4:50 AM

re: 7zip

Yeah, I did a pile of testing with various tools. I use a 2GB/dual core box so multithreaded compression helps me. WinRK was about 10x slower than 7zip in my early tests, and SBC can't do files over 2GB so I didn't test them. Sample below:

21,474M 20GB-XP-VS-Of-D7.vhd
4,868M 20GB-XP-VS-Of-D7.vhd.gz
4,583M 20GB-XP-VS-Of-D7.vhd.bz2 5% smaller
4,155M 20GB-XP-VS-Of-D7.rar 10% smaller
3,830M 20GB-XP-VS-Of-D7.7z 8% smaller

I use this to put 10GB+ VPC/VMware images onto a single DVD. To do that I clean up temp files, defrag, set the system to zero page file on shutdown, zero the free space, then compress.

My standard WinXP+ VS2003+ MSDN+ Delphi2005+ code goes on one DVD that way (it's a 20GB virtual disk). So two or three copies of the single DVD make it unlikely that I'll have a failure. With two DVDs per set, I'd need 8 copies to get the same security as 3 single disk copies.

The backup/live storage issue is also pretty significant - I have about 5 live images, and another 20-odd archived on the hard disk. Getting those rarely-used but important images down to the smallest possible size is quite useful. Who cares if it takes 5 hours to do it? I have spare machines at work for that ;)

I'm a big fan of archiving release points, or any other significant thing (just before we upgrade a 3rd party component or tool, for instance). Smaller images = more points archived.

Moz on October 21, 2005 7:56 AM

your OS will use your pagefile before you're anywhere near close to using up all of your memory. if it waited for you to run out of ram before using it, then the things in your pagefile would be whatever you've just loaded - which is ridiculous, that's the stuff you need to run fast. what windows does, is it moves things that don't look like they're being used into the pagefile, to free up physical mem. what this means though, is that you can easily find yourself using the pagefile when you actually have pleanty of spare ram.

my home pc is switched on all the time, and i was sick of all my minimised windows (which is sometimes all of them) moving into the page file. i shouldn't have to site around waiting for my hard disk to spin up just to restore something that i've already loaded. i've stopped this problem now by switching off my pagefile (i have 1.5GB ram, and leave things like flash and open while i'm playing fear), but if you're worried about doing that i suggest you at least set your pagefile to 2meg default size, with a much larger maximum - so it normally doesn't get used.

sean on November 9, 2005 7:16 AM

Well weird enough XP still uses virtual memory even
if u DISABLE swapfiles completely.

Easily noticed when typing dxdiag

On my system it uses 236 mb of 1560 mb although
i have shut down the swap files 100%.

And sort of annoying having 2GB of ram, telling my
OS NOT to use any disk paging and it obviously still
does what it wants.

Dopeshow on November 13, 2005 5:16 AM

is there another, better way of switching the pagefile off?

sean on November 15, 2005 11:34 AM

Dopeshow:
Are you sure? Is there a pagefile.sys on one of your drives? It seems to me that once you've disabled your pagefile, any statistics about it refer to your actual RAM instead. So a reported PF usage of 250MB actually means a RAM usage of 250MB. I find it quite convenient ;).

Although it has happened to me once, that Windows spontaneously started generating a pagefile (pagefile.sys and all), even though I had disabled it.

Still don't know what caused that...

RiX0R on November 16, 2005 6:23 AM

Update: I have reverted to a standard "system managed" pagefile after running for about a month without a pagefile, both at home and at work. Although I have 2gb of RAM on both systems, I would occasionally encounter some rare, bizarre behavior that I couldn't explain.

Since nobody can quantitatively define what, exactly, we're gaining by running with a pagefile off (benchmarks, anyone?), I no longer think running with the pagefile disabled is worth the risk.

So, interesting experiment, but ultimately I think people are better off with the default pagefile. Until someone presents compelling perf benchmarks that show benefit, it's too risky.

Jeff Atwood on November 23, 2005 4:39 AM

Hi,

I know this post is a bit late, but I thought you might want to read this post by Larry Osterman, about the risks of running without a paging file:

"Mea Culpa (it's corrections time)"
http://blogs.msdn.com/larryosterman/archive/2004/05/05/126532.aspx

C-J Berg on December 4, 2005 10:34 AM

I'm unconvinced by the points regarding the way Windows pages out applications that are idle.

The reason I'm unconvinced is not because I don't think this happens. On the contrary, I know that it does happen. The key points is that I also happen to know that a lot of this 'paging out' doesn't actually use the swap file.

When Windows decides to trim the working set of a program, it doesn't necessarily evict pages to the swap file. For some pages it has another option that has thus far been ignored in this discussion: it may be able to simply free the page without writing it anywhere!

Typically the working set of a process contains a lot of read-only pages: the code that makes up the application. The OS can evict these pages without touching the page file. 'Swapping out' such a page consists of moving it to the free list. It doesn't write the contents to disk.

After all - why would it write the page somewhere? It has a copy of the original page sat there on disk in the DLL that it came from. If that page needs to be swapped back in, it'll just go and reload the original off disk.

So the only pages that get swapped into the swap file are (1) allocated memory such as the heap or stack, (2) writable data segments that have actually been modified (Windows supports a copy-on-write scheme) and (3) code pages that contain relocations in DLLs that had to be rebased when loaded. (I guess they could technically redo the relocations, but my understanding is that this doesn't happen.)

So I wouldn't expect switching the page file off to stop idle processes from having pages evicted. It would just change which pages got evicted.

In fact it might make matters worse. The OS would be unable to evict dynamically allocated pages like the heap or stacks meaning it would have to get more agressive about evicting other pages.

In the 'I have a pagefile' situation, the OS can choose to evict any page it likes. If it needs to trim 10 pages out of my application due to memory pressure elsewhere, and it detects that I don't seem to be using 5 pages in the heap and there are 5 more pages from readonly sections that I'm not using, then it can evict those 5 and 5 respectively. But if I don't have a pagefile, it has to take 10 from the readonly sections even though there were only 5 I wasn't using...

That's not going to improve matters.

Ian Griffiths on December 17, 2005 12:30 PM

Its really UGLY to see guides just for Windows XP, there are still Stability Fans that use Windows 2000, can anyone please explain how to disable the paging file throught Registry Editor?

KinetiK on April 9, 2006 8:32 AM

What I think as good or bad as things seem, WindowZ requires a pagefile(PF) and depending on WHAT applications are used, that should be relative to the amount of RAM and the PF combined. I don't mean 1.5x or 2x etc, I mean e.g. if you have 2GB RAM, not much of PF goes on, so you could have a smaller PF of say 512MB! Once you RAM goes over the top, you still have another 512MB extra for PF! It's the way I've been using systems the last 3+ years without any problems. There is another case when larger RAM-gobling programs like e.g. Premier would require a little more RAM (but still wouldn't go over the 2GB RAM, but having just the extra 512MB for 'WindowZ's Sake', is not a problem.

The set-up:
1. Partition a disk with slightly over 512MB, because WindowZ needs a part of it for "internal affairs" (say 533MB and label it "swap" ;-).
2. Disable the pagefile and set it to only that new partition created. Min and Max? I say 128min, 512max -or try other and see the difference.
3. Start using this solid and stable solution to WindowZ.

Now this configuration should work for most PCs with 1GB to 2GB RAM, allways depending on WHAT applications are being used, but in some cases might not be the best choice! Why? Background running programs, ANTI-virus and all other sorts of resource demanding software could make this not the right config., which I don't have any ;P.

The system:
WindowZ XP SP2
AMD FX-55, 2GB RAM, ASUS AI-SLI M/board,
256MB gForce 6800 ultra
80GB Raptor 10000rpm
SB Live 5.1
HP1210 PSC
Camera

The applications (activley used):
Firefox, Thunderbird, OpenOffice, The GIMP, Nero 7.2, Premier Pro 7.0, Alias Maya 7.0, Bunch of 3D-type Games like Doom3, FarCry, HL2, CS , POPWW, SCCT, Multimedia: M$N Msgr, MediaPlayerClassic and other minor apps used inbetween (no antivirus or of any kind -utilise all user-type securities, no Admin. rights!)

Tip: Try and use applications that don't need installations or use very little system resources!

gumstic on May 19, 2006 11:53 AM

I think most of the posts I read come from people who are assuming the page file works correctly. My problem is I have a high raid system (not by my control, the server I am assigned is a 4 disk completely raid system). To use any of this for swap space seems to kill performance. I have noticed in ALL windows systems I have viewed a rather large page file usage WITH PLENTY OF RAM AVAILABILE.
The page file is not just used when the sytem runs out of RAM.
So maybe this memory is just allocated and not used, but if I have 1GB RAM available, and 512MB paged, wouldn't it be more efficient to use the RAM and still have 512MB available? This is not what I have seen.
OK. So my main problem is on a Windows 2003 server running MS SQL 2005, I have turned off the page file completely, have 4GB physical RAM, and the page file seems to almost always match whatever physical RAM is in use, even with the page file supposedly gone and disabled and physical RAM available. If the server is using 1GB RAM, the PF usage is (about) 1GB. This behaviour server seems inconsistant with the majority of tech posts I read, which seem to assume if the PF usage will only be up if you are low on physical RAM. Of the dozens of tech posts I read, it seems like I only come across one or two people that recognize this behaviour. Is this "OS not listening to instructions" specific to Server 2003?

On a high-RAM XP Pro pc I checked I see 156MB PF usage, even though there is 1.5GB of physical RAM still available.

Aurelio on April 26, 2007 10:27 AM

Hmmmm. Obviously foot in mouth. To be honest, this is the first post I have read where the majority of people recognize this PF usage reported when there is plenty of RAM.
Is there any reference article by MS that says the PF usage reported when there is no PF is actually RAM, or are we just assuming? I am just curious because I still don't believe it is not using a PF based on the performance I see. The IO still seems to be hit hard.

Aurelio on April 26, 2007 10:32 AM

"In the Task Manager utility under Windows XP and Windows Server 2003, the graphical displays labeled "PF usage" and "Page File Usage History" are actually reflecting not the pagefile contents but the total (or current) commit charge. The height of the graph area corresponds to the commit limit. Despite the label, these do not show how much has actually been written to the pagefile, but only the maximum potential pagefile usage at the moment. In Windows 2000 and Windows NT 4.0, these same displays are labeled "Mem usage" but again are actually showing the commit charge."

http://en.wikipedia.org/wiki/Commit_charge

Him on June 6, 2007 2:46 AM

No matter how much memory your system uses it will always use virtual memory. If you have 2 GB of RAM and only 256MB of memory being used a good portion of that can be put into virtual memory. The key to knowing when to disable it is to look at the task manager to see the peak total memory usage. If it does not ever go over your total RAM then you disable it. If it goes over then you don't diable it. Of course I have had commercial software that act wierd unless they have a lot of virtual memory even if they don't need it.

Will on June 18, 2007 7:15 AM

I am actually having a problem with my pf in windows. While using programs the thing works fine but even if all the windows are closed and there are no programs running and I have a completely blank usage aside from necessary system applications that always run (ie explorer, wdfmgr, svchost, etc.) my pf usage keeps climbing higher and higher over time. It is almost as if windows refuses to wipe the content off after it has been used. Any others have this problem?

bulsatar on June 30, 2007 9:21 AM

CLEAR PAGE FILE

http://netsecurity.about.com/od/windowsxp/qt/aa071004.htm

LO8 on August 6, 2007 5:38 AM

What about using a fixed size for the swapfile? I heard it's good for performance. But messing with these settings can break some apps and games. For example, I was running with a fixed 1048MB of swapfile until resident evil 4 (PC port) kept crashing after a specific event.
Bad Capcom and it's crappy pc ports...

Hoffmann on August 24, 2007 10:01 AM

What about if you use 4gb ram?How much have to set the PF if you need it?

polaki on September 8, 2007 11:45 AM

I've been searching all over for info on why windows reports page file usage even though I have virtual memory disabled, and finally "Him's" post linking wikipedia helped explain. Thanx!

Rob on September 10, 2007 4:02 AM

I have been running a 1GB XP without a pagefile for a year now, and no problems whatsoever! I never turn my computer or programs off, and I'm experiencing a significant performance boost when switching programs, because Windows tends to stuff unused program in the virtual memory even if there is plenty of ram free.

Biggles on September 19, 2007 11:24 AM

I've been running without a pagefile for 3 years now and I must admit that my PC (7 years old!) is much snappier than the ones with pagefile turned on even though they are theoretically much faster.

For unbelievers: how much time does it take to open a compose window in Thunderbird after having it minimized for at least 30 minutes and working other applications? For me it was like 10+ seconds (once it was 90 seconds!). Now it's always less than a second. It sounds like a 1000% improvement, isn't it?

For those who think that Windows doesn't swap if it's not necessary: run Eclipse with a very big project (or any other big Java application) and leave it for a night. Then come back and try to do something. It's almost impossible because the whole Eclipse (java virtual machine) is in the pagefile!

Yes, disabling virtual memory may cause errors in many applications (especially bad written ones), but think this way: what was your total memory two or three years ago? 512MB RAM + 1024MB swap? If that's the case, then 2GB RAM + 0MB swap is still better than that.

Jezzy on September 22, 2007 3:47 AM

Its really UGLY to see guides just for Windows XP, there are still Stability Fans that use Windows 3.1, can anyone please explain how to disable the paging file throught Control Panel?

KKKinetiKKK on September 23, 2007 1:57 PM

Just saying i agree 100% that windows moves stuff to the pagefile when it doesnt need to. turning the pagefile off fixes this. After reading about turning the pagefile to start at 2mb, im going to run that for now and see how it works out for me.

pocus on October 5, 2007 12:28 PM

Running Windows XP x64 with 4GB RAM and no pagefile. Everything is super snappy and just fine thank you!

pcunite on December 12, 2007 8:51 AM

I have to use monstrous Delphi 2006 IDE on my work PC(it has many memory leaks and eats up to 600 mb). With the page file on , every time I open 'file' menu the system starts to read hdd. (Without pf it's allright.)

Look, open taskman, if you minimize *any* application's top level window the system will call EmptyWorkingSet() and flush the *entire* process' working set (600mb) on your hdd regardless of ram size.

ram_speed = O(hdd_speed) what else can I say?

Boris on December 14, 2007 2:16 AM

I've recently come across tech enquiries WRT 0MB/No pagefile setups. Seems that certain applications WILL complain about having no pagefile even if you have a ton of physical RAM - sometimes even refusing to run. Even WinXP will warn of the absence of pagefile upon boot (lotta Asus EEEPC users who shoehorned in 2GB of RAM and WinXP got this).

There anyway to bypass these dumb checks? Right now I had folks locking pagefile to the bare minimum to keep programs happy, but that kinda defeats the purpose of killing the pagefile entirely =.=

A chicken passeth by on December 24, 2007 12:27 PM

Oh, and I almost forgot. Can anyone running on "No page file" check the Windows\System32 for a file called Temppf.sys? I am told this is a temporary page file for when the original is either turned off or inaccessible - and the file will still be created even if the pagefile function is turned off...

A chicken passeth by on December 24, 2007 12:33 PM

Re: CLEAR PAGE FILE

When you do this, it takes forever to shutdown because you are clearing the page file out. Why not just set your page file to zero, restart, delete your pagefile.sys and run a defrag. Then recreate it with your min and max the same.

Brian on January 31, 2008 4:39 AM

I have a slightly different reason for wanting a zero sized PF. When I Ghost image a hard drive, I'd like to minimize the image size to minimize the media quantity. One DVD used to be enough, but I regularly use multiple DVDs now.

I certainly could set the PF small, 100MB to do this.

But if XP secretly creates a PF the size of memory anyway, I'm still Ghosting the file . . .

Yes, a page file of 1GB is not that much, but it is one of several areas I minimize or delete to decrease the Ghost image size.


todd

todd on February 5, 2008 5:25 AM

@todd:

Imaging software like Norton Ghost, the Acronis equivalent and the like, usually have parameters (or options) to set that excludes files of choice, and the Paging File is usually left out by default.

CJ on February 6, 2008 1:24 AM

Good point, tnx. That's difficult to verify because if I restore, then boot Windows, Windows may create the pagefile.sys anyway, per some of the above comments. I think I've seen that.

I'll have to try Ghosting twice, once with and once without VM enabled and compare the Ghost file sizes.

todd

todd on February 6, 2008 5:20 AM

Given WinXP's propensity to swap things to the page file despite lots of unused RAM, wouldn't it make sense to place the page file in a Ram Disk on, say, a 4GB RAM system to reduce hard disk read/write (to a HDD-located page file)?

Bill on March 28, 2008 11:32 AM

Page file in RAM disk does sound like an interesting work around. Really you should need a work around if the OS is working correctly... which XP doesn't.

Here's the bottom line about swap space. There is absolutely no gain in swapping memory pages if there is available RAM. None. Not a single reason that justifys this. It just slows things down and wastes RAM, end of story. Pointless, brain dead, retarded.

When you get to say 95% then some pages from the file cache can be marked available and any new allocations of RAM loaded in there. When the file cache is gone, then and ONLY THEN, is it time to use the page file. Not before.

Obviously Microsoft were counting there money when this class was going on at Redmond Uni.

Check a Linux system's swap usage to see it done properly.

Here's a slightly different twist as well. Consider Windows XP 32bit with 4Gb of RAM. Address extensions aside. It cannot actually address anymore RAM. However when you boot it, it still allocates a 3Gb page file... and puts stuff in it!

My 4Gb system is current running flightsim. I have 2Gb of free RAM and it's using 1.2Gb of swap space.

Here's the thing. If it is using 1.2Gb of swap space it cannot actually address 1.2Gb of physical RAM, due to the 4Gb limit.

That's just stupid.

If I turn off the swap, it simply makes up its own mind and allocates a 3Gb swap file anyway.

Paul on March 31, 2008 9:36 AM

I'm thinking of making a server (based on windows server 2003) machine with 2Gb RAM for starters wich I will update to 8 Gb soon. Now, knowing that the memory needs of all software (OS included) will never surpass the amount of RAM I have installed would I have any real benefit from forcing the Windows OS to place all and every memory need in RAM only (aka disable pagefie)?

I've read some say that it does indeed make programs respond faster by never allowing them to be put on the pagefile (regardless of available RAM) and keeping them all in RAM, but I also noticed some people claiming that Windows will (by it's own will?) create a "temporary" pagefile.

Can anyone confirm both (or any of) these claims? Thank you!

Anyway I'm thinking of testing both ways (with and without pagefile) and then come here to post some reality tested results.

Regards to all participants!

Seijuro on April 2, 2008 7:10 AM

I just want to put out into the infoverse that I've disabled my swap file on an XP machine with 4GB RAM and...

As per all these arguments about how the swap file only gets allocated things you dont need anyway...one of those things is the START menu and subsequent subfolders. Ever get annoyed how slow it all becomes when you have a lot of programs? Well mine's as snappy as can be now...

Another example is the multi-tiered options in the right-click menu for files. It used to really lag...

Or load up photoshop while running a backup and work with it seriously for a few hours, then go away for lunch and come back and see how windows has decided its GUI belongs in the swap file but the backup is hogging to many resources now so you can't continue working until the 12 hour process is done... I hate the swap file!

Anyway, i just started this test today so its early yet though I did have photoshop, after effects, outlook, itunes, IE7 and several firefox tabs open at the same time with no noticeable effect....and task manager claims i still have 2GB free! woohoo..

And for the philosophers: Before I had 1GB with a swap file of 1-2GB which leads to a max of 3GB of virtual RAM. So if everything ran fine with this, surely having 4GB of physical RAM and no swap will be fine too?

Hari Karam Singh on April 13, 2008 1:46 PM

So I have 8GB of ram... do I still need the Page file? ;)

Technically windows should not use paging unless its necessary... with 8GB it should not be! But windows treats 8GB as if it were 8MB and so pages any non-essential code/data when the whole kernel could and should be kept in memory along with all smaller data files.

I guess the best of both worlds is to put the page file on flash similar to how vista works?

Jo on May 7, 2008 7:57 AM

Hi All,

I just Disabled swap file and on my laptop which has something like.. 2GB of RAM. Well as others I noticed Windows simply puts minimized applications to swap file for no obvious reason when there is more than 1.5 GB of RAM left. Especially when my system is kept idle for some time. Windows follows 'demo+crazy' :) its crazy and does not care for..
your customized settings. .. bla bla..bla.. to go wikipedia link for commit_charge information about task bar.. it will shed some light.

I will continue using the system this way till I encounter some serious error.
I can confirm at least at the first glance that my pagefile.sys which was 2gb was also deleted.
and windows didnt yet create any Temppf.sys anywhere in my system yet.

If i find one I will report it back here.

Cheers!
Mohnkhan
Mohiuddin Khan Inamdar

Mohnkhan on May 21, 2008 9:57 AM

Hi,
i am using xp tiny with 1GB of RAM and it always allocate me 931MB of swap no matter pagefile is on or off.
I dont get it and cant even locate that swap!

swapp on May 22, 2008 3:35 AM

One reason for turning off the pagefile, which hasn#8217;t been mentioned yet, is for security reasons in relation to file encryption.

When creating a file that is later encrypted (for instance a Word document), Windows and its filesystem will create multiple instances of the file on the hard disk, along with temp files. With an active pagefile, multiple instances will end up in the pagefile too, no matter how much physical memory is installed. If you then encrypt the finished Word document, you#8217;re not really achieving much, because all those instances of the file are recoverable from the hard disk, including inside the pagefile.

Switching off virtual memory solves the #8216;plaintext leakage#8217; problem in relation to the pagefile. The other issues can mostly be solved with judicious use of a RAM disk and some Windows tweaking (the goal is: create plaintext in RAM encrypt in RAM copy encrypted file to hard disk). An alternative is to use a full-disk encryption program such as TrueCrypt. Sorry for going a bit off-topic.

In my experience, turning off virtual memory does improve stability and performance. It was the case when I was running Win98 on a 320mb laptop, and it#8217;s still the case now I#8217;m running WinXP on a 4gb laptop with a couple of 1.5gb VMware virtual machines (with their VM turned off too). I#8217;ve even gone so far as to turn off VMware#8217;s own virtual memory too, in an attempt to cajole my system into keeping as much in RAM as possible, with no major ill effects thus far.

However, everyone#8217;s setup is different, and it all hinges on the software you use and your own usage patterns. My advise is it doesn#8217;t hurt Windows to turn off its virtual memory, so try it and see how you get on. If it improves things, great; if not, simply put it back to how it was before.

Mr D721e4ad on May 22, 2008 5:17 AM

As this article says (top of this page) to disable the swap file choose the option "No paging file". Do not set the page file size to zero as it may not have the result you would expect. For me, after setting the page file to zero the windows task manager still reported a total of virtual memory: 4GB = (2GB Physical + 2GB swap file). After choosing "No page file" the task manager reports 2GB = (2GB Physical + no page file).

-- 2 Important reasons for disabling the swap file are:

1) that MS Windows insist in enlarging disk cache to a point that it forces not recently used "Memory Pages" to be swap out to the swap file. This for a web server that serves numerous large files that are accessed rarely is a problem (you are better off using linux). The same effect can been seen on a workstation when you writing a large DVD, or copying gigabytes of data.

2) ALSO a MAJOR problem is this:
when a process start heavy IO, e.g. windows explorer copies gigabytes of data, then the swapped out memory pages of programs take too much time to get back in to the physical RAM because the disk is busy performing other heavy IO. To make things worse the windows keep insisting to trying to get the disk cache as large as possible: the result is that if you leave a window unused for 10-15 seconds it is swapped out (to make room for the disk cache), then you need another 10-15 or more seconds to get the window to reappear (needs to get its memory pages back to the physical RAM).

Suggestion: no swap file, you are OK unless you have an incompatible application (very rare) or a bad application with severe memory leak.

Suggestion: if you do heavy IO and want to keep the swap file, use your old 40-120 GB disk to place the swap file or spent a few money to buy the cheapes harddisk and dedicate it for swap file usage only.
So when you main disk performs heavy IO the secondary disk is free to access the swap file. Also remember to space out your hard disks or they will overheat sooner or later.

George on June 11, 2008 10:00 AM

If you have 4GB of ram you still lose .75 GB for system reserved space. So, knowing the hard limit for useful application memory is 4GB, if you set your pagefile size to .75GB you have covered the 4GB of addressable space, and you should never run into problems except when applications/os is doing retarded stuff like allocating a massive amount of memory for an app before it needs it.

And to respond to that guys comment above about disk space being cheaper than Memory : Get real buddy. 4GB of RAM is now like $100. There is no reason to be penny pinching here. The performance of virtual memory vs. DDR2 RAM is comical at best.

Kevin on July 6, 2008 11:12 AM

@A chicken passeth by:

I can't find that file you're talking about, the temppf.sys file. If I do, I'll post back.

I know this is late post but hopefully this helps someone make the leap. I just disabled the paging file on my x64 XP box and I got a HUGE boost in performance of all my applications; most especially my virtual machines. I didn't even realize it but Windows was paging VM memory to the hard disk despite the fact that I told VM I wanted it all kept in RAM. Nice.

So far I've opened every application I normally do (Nero, Outlook (let's talk about a memory hog), VMWare, Directory Opus, OO Defrag, Skype, TrueCrypt, etc.) and haven't had an issue. Like I said, they're all running better than I could have expected.

That being said, I also have 8GB of RAM. I guess that much RAM kind of makes a difference. I built this machine to be as future proof as possible (that's a laugh, it was obsolete the next day when EVGA released the 790i SLI mainboard SIGH) so I went kind of stupid-overboard on everything including the RAM. I've never tried running without a page file on anything smaller than 4GB. I have an old laptop with a gigabyte of memory; I think I might try it and see what happens.

Cheers to all posters, thanks for all the tips and information and . . . happy no-paging!

psychosmurf on July 8, 2008 10:03 AM

Very interesting post.
I have always known or thought that working XP SP2 with no pagefile would ultimately alter XP and prevent it from booting requiring a new install?
It does not seem to be valid at all.
Can someone confirm that disabling the pagefile is
1) SAFE
2) will preserve XP integrity
3) is not likely to end up having to reinstall XP.

Thanks very much
Ghiom

Ghiom on July 25, 2008 5:46 AM

And some other questions:
(I have 2Gb of RAM)
If I disable the pagefile and encounter a memory leak (using Fligtsim for example, eg it happens sometimes), what will happen?

No if I have a windows crash (normally, I have the blue screen, memory dump, and reboot). What will happen in case of absence of pagefile?

Thanks
Ghiom

Ghiom on July 25, 2008 6:02 AM

@Ghiom:

I've been running XP with no paging file almost a month now and have not experienced any issue whatsoever. I run everything I was able to before and every program runs better than I could have wanted. I can confirm that you're question 2 and 3 above are true: turning off the paging file does not affect the integrity of XP (or Vista for that matter) and you won't have to reinstall the OS if you do. Its a simple procedure to turn it off and its simple to turn it back on if you do experience behaviour that is less than desirable.

Number 1, however, is a matter of perspective. It's safe in that turning off the paging file will not affect Windows unless you have a small amount of RAM. I would NOT recommend disabling the page file for systems with less than 2 GB RAM. I've disabled the page file on systems with only 1 GB of RAM and my experience was not good in that scenario. The OS itself requires about a GB to function properly. Running programs with no page file on a system with only 1 GB of RAM was virtually impossible (no pun intended). If you have a system with less than 1 GB of RAM: DO NOT DISABLE THE PAGE FILE. If you do, you're likely to not be able to boot windows normally and will have to go into Safe Mode to restore the paging file operation depending on what's running on the system. You will not, however, have to reinstall the OS.

All that being said, software behavior is a different story. Memory leaks with no paging file are likely to cause application crashes as your physical RAM would be filled to capacity (but I would note that such crashes may also occur WITH a paging file depending on how bad the leak is and whether or not Windows decides the application is detriment to the system). This usually doesn't crash the OS, however, only the application with the leak. Since I disabled the paging on my system, I've created situations where I had too much open on my machine and filled my physical RAM up (this was to stress my box and see where the limit was). Windows simply would not load any additional programs and the memory hog eventually crashed back to the desktop when there was no more memory for it to eat up. Windows continued to run and I was able to launch the offending application again without problems.

Point is, it's safe as long as you keep it safe. As a guide I would recommend getting software to monitor your memory usage for a day or so (you can even use task manager if you want). Check to make sure that you're not using more than what you physically have in your box during a normal day. If you continually see a commit memory usage of more than what you physically have; this would be a good indication that working without a paging file isn't going to be best for your system based on your current behaviour. For example, if you have 2 GB of RAM installed and continually see a commit usage of 4 GB, chances are turning off your paging file is going to prevent some programs from loading and might even destabilize the system depending on what you have running in the background. If, however, you're seeing the system use 4 GB of RAM when Outlook, Word, Excel, 3ds, Acrobat, AfterEffects, DreamWeaver, SoundBooth, and Premier are open . . . you might be able to get away with not using the page file if you can modify your use behaviour to only use certain of those programs at a time; i.e., work smarter not harder and all that. This latter would require you to be very conscious of your activities on your machine and be aware of what programs are open and running at any given time.

Hope this helps.

P

psychosmurf on July 29, 2008 9:24 AM

How about a page partition instead of a pagefile? It is faster as the OS does not need to translate the read/write to the files into a the acutal read/write to the raw sectors. We are writing to a partition and not a file in a file system on the partition. No abstraction means a faster read/write and better pagefile performance.

Luke on July 30, 2008 11:08 AM

what about mounting a 1gb RAMdrive (for 4gb machines) and putting the pagefile there?

dmtl on August 9, 2008 9:49 AM

i have very old pc, 448 RAM, and it says my page file usage was over 640 ! It never happen before, so can everyone plse tell me how to make my com fast again? I have already cleared my IE history, Mozilla history, mu processes doesnt go above 40. I don't want an opinion 'you have to buy a big RAM memory', because i'm pennilless and could'nt afford them like you guys who have 2G, 4G, and 8G of RAM.

sai on August 9, 2008 12:05 PM

Its totally safe to run windows xp without a paging file, i know because, even back in windows 2000 i wasnt using it either. When i install windows on one of my computer, thats one of the 1st mod i do - no paging file - no annoying access to my hard drives ever. never had ANY issues in 4 years +.

GB

warriorofice on August 12, 2008 3:02 AM

oh yeah, i forgot to say i have 2gb of OCZ dual Channel RAM. Ram is way faster than any virtual memory windows might create on an hard drive. Windows cannot crash because you have no paging file. Even if the code of a bad software require access to it, the ram will sort it out. As long as you have MORE Ram than everything that need to be loaded when windows start, you can see that in the task manager - under performance - but with 2gb, my advice to anyone is to turn off the virtual memory.

Even when i do code with C++ i don't use the page file, even when i play very demanding video games like bf1942 and recent video games. Just try and see for yourself.

warriorofice on August 12, 2008 3:10 AM

[...] because Windows will move pages from RAM to the pagefile only when necessary.

Sorry, that's 100% pure bullshit. While this was true in the good old times (with NT4, for example), modern operating systems (and this includes XP) use *precleaning*. Precleaning is a strategy where the OS writes dirty pages to the pagefile even if there is plenty of free RAM. These pages are then kept in RAM and the pagefile simultaneously. If the application needs them, fine, they are still in RAM. If memory usage suddenly increases and the system needs virtual memory (like when a huge application gets started), the precleaned pages are already in the swapfile and the system doesn't have to wait until they are swapped out. Looks like a win-win situation, right?

Actually, not quite. Since some pages get dirty all the time (for example, by an application which just displays the current time...), precleaning happens all the time as well. The disk with the pagefile is therefore accessed frequently. For a mobile computer (laptop or whatever runs on batteries), this means increased battery drain. For an office PC, this means increased an noise level because the disk never spins down, even when the machine is not in use.

Furthermore, you gain no performance improvement by turning off the pagefile.

Oops, bullshit again! Agreed, the additional I/O load which is caused by precleaning is quite low and usually doesn't hamper the system performance very much (unless you consider battery power consumption as a part of system performance). However, real life seems not to agree with the bright and happy theory. File caching, for example, uses RAM and may use precleaned pages if they are available. Well, bad luck for any precleaned page which gets claimed for such a purpose but needs to be in memory just a few milliseconds later...and such things happen because the OS can not really guess where the user will click next, and which page will then be needed. Well-meant caching strategies can in these cases kill the system's performance. With virtual memory disabled, caching will be decreased when free RAM decreases.

Now, what is better: less caching or more virtual memory? Your mileage may vary, but my experience (and that of quite a number of other people as well) shows that DISABLING vortual memory on boyes with 4GB *is* beneficial. Not only with XP. On a 4GB Server 2003 TS for example, the difference is dramatic: without VM, Eclipse works smootly, with VM, Eclipse often requires several seconds (!) to process a single mouse click!

Best regards, Klaus

Klaus on September 8, 2008 2:51 AM

Thanks for these inputs.
I remember reading somewhere that someone had to install XP again after disabling the pagefile. Initially, everything was fine, actually even better than WITH the page file. It lasted for some time and eventually, at some point, XP would load and start again. Had to reinstall.
I don't want this to happen as it would be a nightmare to reinstall everything.
I have 2Gb of RAM and mostly playing Flight Simulator.


Ghiom

Ghiom on September 15, 2008 2:45 AM

I deleted the pagefile lol, my system [amd 3000+ 1gb ram] was burning on gas, football manager 2008 wasnt hanging anymore, great stuff, until I got 'delayed write fail' c:\$mft, had to buy a new HD. is it a good idea to have a pagefile on each partition, or just the root c:\

all the best

Dennis on September 28, 2008 9:17 AM

I can't help commenting on this thread as well since this is a topic that has buggered me for a while. I have no in-depth knowledge of Windows system internals when it comes to virtual memory, page file and swapping, but I do get the basic picture and I understand the concepts. I have always wondered why on earth Windows swaps out pages from inactive processes even if there is plenty of RAM available. The only effect I see in this is the fact that a machine with 4 GiB such as my development PC behaves like a 10 year old underfurnised office box when I have many windows open and switch to one that was backgrounded for a while.

What annoys me even more is the fact that 'experts' keep repeating that this is not the case when it clearly is and strongly advise against disabling the swap file when, as most people who did this reported here, there is no harm in it but in fact a benefit. I have now disabled paging altogether in my machine and it has become extremely snappy and fun to work with. So far, I have not encountered a single problem even while running memory intensive applications.

The only situation I can imagine where this would cause problems is when applications rely on inter-process memory mapping or file mapping. As I understand it, this definitely requires a page file.

Bests - Dietmar

dietmar on October 6, 2008 6:53 AM

I tried it on my Win XP laptop. My Outlook 2007 started failing with the following error:
Faulting application outlook.exe, version 12.0.6316.5000, stamp 4833a470, faulting module unknown, version 0.0.0.0, stamp 00000000, debug? 0, fault address 0x06dc9580.

The error got resolved once I turned it back on and restarted.

Dharmesh on October 30, 2008 7:26 AM

Learn/understand what swap-space is an after that start giving advices.
Start learning from books, not forum's or blogs.

NR4 on November 25, 2008 3:56 AM

Mark Russinovich of Sysinternals has put together a very insightful guide:

http://blogs.technet.com/markrussinovich/archive/2008/11/17/3155406.aspx

Of course you need an IQ of over 200 to understand it, but it's surely a better guide than the possibly confused testimony of the average passer-by.

Ethel the frog on November 27, 2008 5:23 AM

I setup for NO PAGEFILE and UltimateDefrag 2008 would die on Analyze-Options-Boot Time (which is the interesting part of the program), with a C++ runtime error. Everything else ran fine w/o a pagefile, but adding one of 20Meg made UltimateDefrag work again.

Mr. F. Le Mur on February 6, 2009 10:32 AM

With an i7 and 6GB RAM I hardly see the need for it. With everything I need to load my RAM sits at 20 - 22% used, (Around 1.2/1.3GB) which includes Firefox, Winamp, Xfire/MSN, uTorrent, IRC etc.

I don't think any programs or services are likely to spontaneously expand 4GB.

Cody on February 16, 2009 12:39 PM

Interestingly after setting a custom pagefile with a minimum size of 100mb, max 1000mb, Task Manager reports around 600mb used.

When I observed the size of pagefile.sys it was 100mb.

After using the machine for a little while XP popped up with a ballon informing me my pagefile was too small and will increase it. Looked again and pagefile.sys was about 110mb.

Loaded Warcraft 3, started a game and alt-tabbed out - pagefile.sys was now 104mb, Task Manger reported 720mb usage.

This is a far from comprehensive test, but it seems as if XP will use RAM for the pagefile as much as possible; given that (possible) fact I personally like to have a small windows pagefile set up for the small percentage of applications that might require it. Plus I don't want to run the risk of my PC doing unexplainable weird stuff..

Shroomed on July 16, 2009 12:07 PM

Forgot to add: am running a Dell laptop with 4gb RAM.

Shroomed on July 16, 2009 12:10 PM

You mention that if we wasn't using X(our limit) amount of memory we wouldn't use the pagefile anyway...

...but doesn't the pagefile get used when memory in the ram is idle, regardless of if it is full or not?

I have been using pagefile-less for 5 or so years. My main XP machine has 4gb (3.5gb as im still using 32bit) and never had any problems. Even with win2k on 2gb no issues (except the start up message, but that's not an issue).

Simon Keith on February 25, 2010 3:07 AM


Photoshop CS3 demand paging file and refuse to start without it.

Tried this a couple of times. Same result

Josef Makower on September 12, 2010 9:45 PM

For those of you that want to disable your pagefile via the registry, just copy and paste the following to a text file, save it with a .reg extension and run. You will need to reboot for the change to take effect.


Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management]
"PagingFiles"=hex(7):00,00,00,00


If you want to set the pagefile, you'll have to set it manually to get the hex number from your registry. For example, I use the following when setting up new computers.

Windows Registry Editor Version 5.00

; This will set the paging file to C:\pagefile.sys using 4096 as initial and maximum.

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management]
"PagingFiles"=hex(7):43,00,3a,00,5c,00,70,00,61,00,67,00,65,00,66,00,69,00,6c,\
00,65,00,2e,00,73,00,79,00,73,00,20,00,34,00,30,00,39,00,36,00,20,00,34,00,\
30,00,39,00,36,00,00,00,00,00


We use a lot of old legacy applications along with some new memory hungry applications. This setting works for us even if it isn't ideal. And this is for Windows XP. I always found it odd that Windows XP would set the initial pagefile lower that the recommended initial. But I suppose 10-11 years ago, they never considered we would be running Windows XP with 2 - 4GB memory. Especially since Windows XP 32bit can't use all 4GB of memory due to its own limitation. Call me crazy, but I don't trust Windows to manage my swap file, which is the default in Windows 7. I might try disabling my pagefile at home to see what happens, especially when I play some of my CPU hungry games. ;)

Jasen Webster on August 11, 2011 6:29 AM

The comments to this entry are closed.