Should I disable the Windows Page File or Swap File?

Dennis Faas's picture

A visitor chatted with me on the web site other day, and he had a question about the Windows Page file. He wrote:

" I have a question in regard to optimizing Windows and its 'page file'. I have Windows 7 Professional (64 bit) with a 1 terabyte (TB) hard drive, and 8 gigabytes of RAM. My system uses a newer generation Intel processor (Core i5 or Core i7). My question is: do I really need a page file when I have 8GB of memory? In your opinion, which is better: having Windows manage my page file, or should I define a custom page file, or use no page file? "

My Response:

The short answer is that I believe you should let Windows manage the page and swap files (virtual memory) because it's the safest option, resulting in minimal data loss. The longer answer follows.

First: What is the purpose of a Page File and Swap File?

Both the page file and swap file serve similar purposes: they're used to hold data for processes (programs) running on the system. Whenever possible, RAM is used to hold this data; however, if the system becomes overloaded, then either the page file or swap file is written to the hard drive to help free up RAM. The reason it's written to the hard drive is because hard drives have always had more storage than available RAM. That's why RAM is referred to as 'primary memory' and hard drives as 'secondary memory', or 'virtual memory'.

Because the hard drive is considerably slower than RAM, having the system write either the page file or swap file to the hard drive is a major performance bottleneck. As such, some people think it's a good idea to disable the swap file or page file, but in my opinion, this is a bad idea.

Even though you have 8GB of RAM, it's still possible to run out of memory (perhaps due to a program that went haywire). If this happened and you've disabled your page or swap file, then Windows may not be able to record the event in its system logs. In fact, most likely what would happen is that your system would freeze up entirely without safely shutting down. Simply put, disabling the page file or swap file would be difficult to troubleshoot, and there's a potential risk of data loss due to a system crash.

Remove the System Bottleneck: Get an SSD

A much better solution would be to remove the bottleneck from the system -- that is to say, make better use of the page and swap file. You could easily do that by purchasing an SSD (solid state disk). SSDs are light years faster than traditional hard drives because they don't have any physical moving parts -- in fact, they are very similar to RAM. My suggestion is that you use the SSD to store your operating system (Windows), then use the 1 TB drive as your 'data' drive.

In doing so, your SSD would also store your page file and swap files. Because SSDs don't have any moving parts, they operate at near-zero latency. In other words, SSDs provide almost instant access to data if your system ever required the use of a page file or swap file, including anything to do with the operating system (Windows), for that matter. Overall, SSDs provide a massive performance increase for any computer system.

Which SSD should You Use?

I have researched SSD's for my customers and the one I recommend is the Samsung 840 EVO SSD -- either 120GB or 240GB is suitable for Windows XP, Vista, 7, or 8. You can see the specs over at Amazon.com -- it's also their #1 best seller and has the best rating amongst users that have purchased the drive. Prices (at the time of writing) are: $79 for 120GB, $128 for a 240GB, and $229 for 500GB.

For comparison: a typical 7200 RPM hard drive would do 100MB to 120MB a second (read) with approximately 7ms (or so) latency at peak performance. The Samsung 840 EVO drive can do 500MB a second read and 400MB a second write, with near-zero latency. I have personally moved all my systems to SSD and I can tell you -- the difference is literally night and day. Even on my little netbook (1.6GHz Atom processor) with 1.5GB of RAM and Windows 7 Pro, adding an SSD was a game changer - it effectively brought life back to my netbook that would otherwise be incredibly slow to run Window 7.

About the author: Dennis Faas is the owner and operator of Infopackets.com. With over 30 years of computing experience, Dennis' areas of expertise are a broad range and include PC hardware, Microsoft Windows, Linux, network administration, and virtualization. Dennis holds a Bachelors degree in Computer Science (1999) and has authored 6 books on the topics of MS Windows and PC Security. If you like the advice you received on this page, please up-vote / Like this page and share it with friends. For technical support inquiries, Dennis can be reached via Live chat online this site using the Zopim Chat service (currently located at the bottom left of the screen); optionally, you can contact Dennis through the website contact form.

Rate this article: 
Average: 4.8 (8 votes)

Comments

Richard Robinson's picture

I totally agree with your comments on SSD, but don't think you really answered the question, except to say "No". I am running 3 gig, 1.8 C2 XP machine. Although "clean me " shows I NEVER get over 1.8 meg or so of RAM, XP was continually spending huge amounts of I/O and time maintaining swap files! So, I disabled it an we run much faster now. An intelligent good swap file "App" would be great, But I feel XP swap is neither of these. I would like to see a log of why XP writes to swap, and maybe some access to option, giving parameter control of the decision making. Sigh yea MS.

Also sorry, (maybe wrong - been that before ... ) but I don't think a swap files saves you from crashing in any circumstances.

richcarriere's picture

HI,

Thou I quite agree with your advise, there is one point where I don't.

Personally I prefer to manage the size of my swap file than leave it to windows.

petershaw's picture

It would be helpful if you would explain your reason as to why you wish to manage the size of the swap file and also how you have determined the size.

lelandhamilton's picture

Windows: page file
Linux/Unix: swap file

essentially the same thing.

I found with experiments through Windows Vista and earlier Windows, UNIX, and other OSes that the size of the page or swap file can drastically affect system performance, especially if your are like me and leave programs running and switch to another...

For 32 bit Vista, the best page file size for me is a static 4Gb, the maximum address space that Vista can access minus a cluster size (probably 4k). Dynamic page file operation can highly fragment your disk with unmovable short cluster groups as the page file expands. Disk space is cheap, so having a static swap file of 4GB (or a few clusters less than that) allows loading of many programs and reduces swapping compared to a page file that is just barely "big enough". A system with a "just big enough" page file can enter a state of "churn" where the system is constantly page faulting and unloading pages needed for other programs to run, slowing down to a crawl (not responsive) and not getting anything done. Think of the page file as virtual memory. If there is plenty of space and large holes, it is easier to load programs in the existing holes. If there is not much address space left, running another program will have to use fragments of the virtual address space, and Vista and earlier are not very good at doing that. If the page file is dynamic, accessing swapped out code can wander all over the disk as more fragments are allocated.

To change to a 4gb swap file, first disable the swap file, reboot and delete pagefile.sys, defrag the disk then enable a 4GB swap file on your system disk.

My first experience with small swap file churning was a DEC VAX Workstation. I had to have the sysadmin double the swap size (as he would not agree to a whole hog approach using my estimate) a number of times until everything that I ran and left open fit comfortably and the system actually ran instead of churning.