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:
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 View blog reactions
« If You're Reading This, You Are a Low-Value Demographic The Nigerian Spammer Anthem »
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 06:16 PMI 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 07:14 PM> 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 07:50 PMI 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 09:52 PMre: 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 06:56 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 (!)
> 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 03:50 PMyour 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 07:16 AMWell 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.
is there another, better way of switching the pagefile off?
sean on November 15, 2005 11:34 AMDopeshow:
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 06:23 AMUpdate: 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 04:39 PMHi,
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
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 PMIts 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 07:32 PMWhat 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 10:53 AMI 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 09:27 AMHmmmm. 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.
"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 01:46 AMNo 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 06:15 PMI 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 08:21 AMCLEAR PAGE FILE
http://netsecurity.about.com/od/windowsxp/qt/aa071004.htm
LO8 on August 6, 2007 04:38 AMWhat 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...
What about if you use 4gb ram?How much have to set the PF if you need it?
polaki on September 8, 2007 10:45 AMI'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 03:02 PMI 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 10:24 AMI'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 02:47 PMIts 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 12:57 AMJust 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 11:28 PMRunning Windows XP x64 with 4GB RAM and no pagefile. Everything is super snappy and just fine thank you!
pcunite on December 12, 2007 08:51 PMI 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 02:16 AMI'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 AM
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 AMRe: 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 04:39 PMI 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:
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 01:24 AMGood 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
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 10:32 PMPage 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 08:36 AMI'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 06:10 AMI 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 12:46 PMSo 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 06:57 AMHi 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
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!
One reason for turning off the pagefile, which hasn’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’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 ‘plaintext leakage’ 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’s still the case now I’m running WinXP on a 4gb laptop with a couple of 1.5gb VMware virtual machines (with their VM turned off too). I’ve even gone so far as to turn off VMware’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’s setup is different, and it all hinges on the software you use and your own usage patterns. My advise is it doesn’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 04:17 AMAs 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.
| Content (c) 2008 Jeff Atwood. Logo image used with permission of the author. (c) 1993 Steven C. McConnell. All Rights Reserved. |