Subscribe to Windows IT Pro
March 17, 2004 12:00 AM

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

Windows IT Pro
InstantDoc ID #42035
Rating: (14)

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.

Related Content:

ARTICLE TOOLS

Comments
  • hey
    6 years ago
    Jun 16, 2006

    Neil (immediately above) is correct. I have become really tired of reading the saaaaame incorrect advice parroted over and over again, especially in the MS Windows XP newsgroups. "Don't you dare disable the page file ... You need it ... Windows XP won't use it unless it's necessary."

    Lies, damned lies, all of it. Tell me, why, on a system with 2-GB of RAM, do I see WinXP put hundreds of MB into the page file, while leaving many hundreds of MB of physical RAM unused? Why does that RAM ... NEVER get used? Why, when I had my page file enabled, did I so often encounter drastic slowdowns as the page file was being read? Why did I see a serious performance improvement when I disabled the page file altogether?

    I mean, come on... Think about it: Microsoft recommends using 1.5 times the amount of RAM installed as the minimum page file size. Does this make ANY sense to you? Think about it. You have more RAM, so wouldn't you need a SMALLER page file, and vice-versa?

    None of their advice makes sense; this article's advice doesn't make sense; and if you have enough memory, disable the page file.

  • Neil
    6 years ago
    Apr 23, 2006

    Daniel is correct.

    Microsoft's claim that the pagefile is used only "when the memory in use by all the existing processes exceeds the amount of RAM available" is blatantly untrue. Let's just call it a lie.

    WinXP tries to send ALL inactive paged memory to the pagefile. It is fairly agressive in what it considers 'inactive'. Don't believe me? Lauch a few large applications (but make sure you still have plenty of physical RAM), leave your computer for 30 minutes, and come back and check the pagefile. If you don't want to figure out which counter to use in Performance Monitor, here is a great little tool: http://billsway.com/notes%5Fpublic/WinXP%5FTweaks/

    As you can see, WinXP will shove as much of your running application to the pagefile as possible. Usually half of my allocated RAM is offloaded to the pagefile even with hundreds of free MB of physical RAM. I have had particular trouble with memory intensive applications, but I see preformance degradation across the board. My 1GB system might as well be a 128MB system, given the way WinXP thrashes my hard drive with pagefile swaps. My total memory usage rarely goes above 500MB.

    Bottom line: if you have a lot of memory (and it is so cheap these days) turn off your pagefile for a dramatic performance boost.

    One warning: You are more vulnerable if you encounter a nasty memory leak, as you have no pagefile to buffer you. So programmers and beta testers may want to keep their pagefile.

    -Neil

  • Anonymous User
    7 years ago
    Aug 21, 2005

    Apparently this is not a good thing. Since it obviously reduces the amount of ram avaliable so it starts using the page file earlier, meaning you would need a vast amount of ram for this to work.

  • Anonymous User
    7 years ago
    Aug 19, 2005

    i'm interested in trying out software based RAM disks: software that creates a virtual drive that is super fast (it's actually RAM), and using it to host the pagefile. has anyone tried this ?

    bob
    2005.duaribulima@gmail.com

  • Anonymous User
    7 years ago
    Aug 17, 2005

    1G RAM, 2CPUs XEON, WinXP, pagefile disabled. Pagefile IS an evil for machines with REALLY lots of RAM. I'm a programmer, so running compilation in two copies of VisualStudio + an instance of virtual Linux (coLinux) compiling something + actively used normal supporting programs like several copies of FAR manager / HIEW / etc. Everything works fine, still never saw memory usage above half of gig. For Win2K I couldn't disable that stupid no pagefile warning although this OS runs OK as well.

    As it might seem from the article, Windows aims to allocate 4G for every application but it's not true. First of all, only 2G not 4G, as since WinNT OS upper memory is never available to applications. Second, only loaded image and commited stack is allocated by default, all other memory is still unavailable (hence neither paged nor mapped) until application explicitly allocates some or exceeds its initial stack size. Even if application allocates say 400M, it's still possible just to map available physical memory without necessarily referring to disk paging mechanism.

    So, my vote by thumbs down to pagefile with lots of RAM.

You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.