Windows IT Pro is the leading independent community for IT professionals deploying Microsoft Windows server and client applications and technologies.
  
  
  Advanced Search 


March 17, 2004

If I have a Windows XP machine that has lots of memory, can I improve performance by removing the pagefile?

RSS
Subscribe to Windows IT Pro | See More Performance Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

A. Any program that runs on an Intel 386 or later system can access up to 4GB of RAM, which is typically far more memory than is physically available on a machine. To make up for the missing physical memory, the OS creates a virtual address space, known as virtual memory, in which programs can see their own 4GB memory space. (This virtual address space consists of two 2GB portions--one for the program and one for the OS.) The OS is responsible for allocating and mapping to physical RAM those parts of the program or memory that are currently active.

To work around a machine's physical RAM limitations, a local file known as the pagefile stores pages (in 4KB increments) that aren't in use. (One installation can have multiple pagefiles.) When a program needs to access a page from the pagefile, the OS generates a page fault that instructs the system to read the page from the pagefile and store it in memory. Because disks are much slower than memory, excessive page faults eventually degrade performance. A computer's RAM consists of two sections. The first section, the non-paged area, stores core OS information that's never moved to the pagefile. The second section, the paged area, contains program code, data, and inactive file system cache information that the OS can write to the pagefile if needed.

Although the discussion so far might lead you to believe that Windows stores only active code and data (plus the core OS) in physical RAM, Windows actually attempts to use as much RAM as possible. Often, the OS uses RAM to cache recently run programs so that the OS can start these programs more quickly the next time you use them. If the amount of available free RAM on your computer is low and an application needs physical RAM, the OS can remove from RAM pages of memory used to cache recently run programs or move non-active data pages to the pagefile.

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.

If you want to prevent Windows from moving any core OS kernel or driver files to the pagefile, perform the following steps:

  1. Start a registry editor (e.g., regedit.exe).
  2. Navigate to the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management registry subkey.
  3. Set the DisablePagingExecutive registry entry to 1.

If you want to determine how much of the pagefile is actually being used, you can download Bill James' various pagefile utilities, which are available at this Web site. Among these tools is a WinXP-2K_Pagefile.vbs script that tells you the current and maximum pagefile usage.

End of Article



Reader Comments
”because Windows will move pages from RAM to the pagefile only when necessary”

Not true according to my experience. Windows 95 and 98 only used the pagefile when necessary. But Windows NT, 2000, XP does use it even when NOT necessary. (And probably also Windows 2003.) The OS seem to free RAM by moving pages to the pagefile even if there is large amounts of unused RAM! I usually se about 20-60MB of the pagefile used for this. Is there a way to tell Windows to ONLY move data to the pagefile when needed?

And another related question…
In Windows 95 and 98 there was a setting in system.ini which you could use to specify the maximum size for the filecache. This was very useful because it stopped Windows desktop, i.e. explorer.exe + loads of dll-files being swapped out when doing a normal copy of a large file.

Example:
Computer with 512MB of RAM.
Windows uses 100MB of RAM after startup.
I copy a 1GB file.
Windows uses all available RAM, 512MB for filecache, causing almost everything but non-paged pool being swapped out to the pagefile.
After file copy, trying to open a folder in explorer takes ages to load!

However, if you reserve 128MB of RAM by setting system.ini to:
[vcache]
MinFileCache=4096
MaxFileCache=393216

Now you don’t have any delays double-clicking folders, opening start-menu, or whatever you do on the Windows desktop.

Is there a way to specify how large the filecache may grow in Windows NT, 2000, XP and 2003?

Best regards,
Daniel Mukka Nyberg

Daniel Mukka Nyberg March 18, 2004


Ahhh, but even a small (32MB) page file can seriously slow down your machine, because ANY program doing any kind of disk access (virtual paging included) has to wait ages while the many disk accesses occur, I proved it! My WinXP Pro PC, with 1.5GB of RAM, runs MUCH faster with no paging file, I VERY rarely see low memory warning from TaskInfo, even when running many large applications (http://www.iarsn.com/).

IMHO Microsoft should fix Windows so that it doesn't need to make the huge number of unnecessary paging operations, as seen in TaskInfo.

Infernoz March 20, 2004


Excellent bit of information. Most commendable and definitely a public service. Thanks,

Joe Vazquez April 10, 2004


I just upgraded my workstation to 1GB RAM and had the same question concerning Pagefile.Sys. Now that I know to leave Pagefile alone, how come Windows XP does not clear the RAM once a program has exited? I was using Nero 6 Deluxe & when I was done it still maintained the 700MB of Ram that it initially allocated.

Steven July 08, 2004


Steven said: "Now that I know to leave Pagefile alone, how come Windows XP does not clear the RAM once a program has exited? I was using Nero 6 Deluxe & when I was done it still maintained the 700MB of Ram that it initially allocated."

Windows frees up RAM only when needed and, when available, uses keeps code for recently closed programs in RAM until another program requires that memory space. It does this so that if, say, you closed Nero and wanted to reopen it, it will load very quickly, because it's still sitting there in RAM. Try it: open a program that normally takes a few seconds to load, close it, then repoen it. It'll load much faster the second time. However, if you open it, then close it, then open another program that uses a large amount of RAM, then close it and reopen the first one, it won't be quite so quick.

The bottom line with the Windows pagefile is this: let the system deal with it - it knows what it's doing!

Anonymous User April 03, 2005 (Article Rating: )


Daniel has it right on.

I currenly have 100+ MB free physical memory, yet currently application A is running with 13MB/20MB physical/virtual memory usage and generating 200+ page faults per second! Nothing else is generating page faults. Wth is this application not entirely in physical memory?? And this is WinXP. The constant paging is using a good fraction of the CPU cycles, making any other application that tries to page really slow, and who knows what constant stress it puts on the HD.

I agree that having a pagefile is a good idea, but WinXP just doesn't do it right. Virtual memory has been a performance issue with Windows for years.. how come it still does obviously wrong things? If people have objectively measured performance gains from removing the page file, then that itself indicates a poor implementation.

Anonymous User April 10, 2005 (Article Rating: )


I have 1.2 gigs of RAM and a 200 meg set pagefile on my XP box and still got the "low virtual memory" error. I checked the task manager and see that I have almost 900 megs of free memory but my Office 2003 apps have swallowed up nearly the entire 200 meg pagefile and wants more!!! I'm pretty PO'ed because I'm using a laptop with a slow Hard Drive so I'd rather XP not page out at all, especially if I've got over 800 megs of memory sitting on it's *** doing nuthin. I've tried disabling the pagefile altogether but that will only result in my applications complaining that I don't have a pagefile. Any suggestions (besides increasing my pagefile, I mean). Plz e-mail me tienbo2000@yahoo.com. Thanks.

Anonymous User May 04, 2005 (Article Rating: )


My PC has 1GB of RAM so I disabled Windows paging file and it worked wonderfully. I think it is only suitable for simple applications such as email checking, web browsing... like me. If you are a developer, a designer or a power user I recommend not to disable the paging file. However, why don't you try it and compare the difference?

Anonymous User May 27, 2005 (Article Rating: )


I have a pc with 1 1/2 gigs of ram and it runs awesome without a page file, i also have a pc with 1 gig of ram without a pagefile and that, although it pushes it- sometimes i only have 80-150 mb of ram free- runs much better than with a paging file.

Anonymous User June 22, 2005 (Article Rating: )


I have 1.5 gigs of RAM and I really only use my main machine for computer games such as Battlefield 2, Call of Duty, World of Warcraft and Half Life 2, page file set to off and never once have I ever gotten a page file error. Of course this is only with games, if I were a programmer, or graphic artist, I would most likely use a page file.

Anonymous User June 29, 2005 (Article Rating: )


 See More Comments  1   2 

You must be a registered user or online subscriber to comment on this article. Please log on before posting a comment. Are you a new visitor? Register now




Top Viewed ArticlesView all articles
What You Need to Know About Microsoft's x64 Server Product Plans

What do Longhorn Server, Windows Compute Cluster Server, and Windows Vista have in common? The x64 platform. ...

Anti-Virus Vendors Prepare for War with Microsoft ... Again

When Microsoft announced its Windows Live OneCare security and PC health product over five years (as MSN OneCare), Symantec, McAfee, and the other consumer-oriented security vendors reacted with stunning vigor. ...

Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...


Windows OSs Whitepapers Why SaaS is the Right Solution for Log Management

Related Events WinConnections and Microsoft® Exchange Connections

Virtualization Management

Check out our list of Free Email Newsletters!

Windows OSs eBooks Understanding and Leveraging Code Signing Technologies

A Guide to Windows Certification and Public Keys

SQL Server Administration for Oracle DBAs

Related Windows OSs Resources Introducing Left-Brain.com, the online IT bookstore
Looking for books, CDs, toolkits, eBooks? Prime your mind at Left-Brain.com

Discover Windows IT Pro eLearning Series!
Clear & detailed technical information and helpful how-to's, all in our trademark no-nonsense format

Test Drive IT Solutions and Get Free Music Downloads
Solve your toughest IT problems with these free downloads and receive 5 free music downloads!


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro DevProConnections IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home asp.netPRO Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 © 2009 Penton Media, Inc. Terms of Use | Privacy Statement | Reprints and Licensing