Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

People say that you always need a page file, and that it will increase performance, but my Windows 7 is set to run without a page file. I simply don't understand why people say this - I have 6 GiB of RAM, and the only time I even came close to running out of RAM was when I was compiling Chromium, for which I temporarily enabled a page file.

Do I really need a page file* for a speed boost in typical situations? Why?

*I'm aware that crash dumps need a page file. I don't ever use crash dumps, though, so that doesn't matter.

share|improve this question
1  
Attention: There is only a limited amount of memory given to drivers, called the non-paged and paged pool memory sections. A page file is necessary for when the paged section gets full, as a gamer I have seen a game complain about paged pool memory just because I had my page file disabled on a 8 GB system. Conclusion: Page files are necessary, they prevent paged pool depletion and actually do speed up your system. –  Tom Wijsman Oct 25 '11 at 11:36
    
Bull. If you have 8GB of RAM sitting there with half of it free, there's no reason a well-designed system should ever try to use a slow disk in place of the RAM hardware dedicated to the task. If drivers need more memory... increase the non-paged pool size and get rid of the paged pool. This whole problem stems from the fact that these systems page memory long before it's ever necessary, like if you minimize a window. Paging should not occur unless the system runs out of memory. If the system lags while it pages stuff out, I'll expect that if RAM is low, otherwise it slows down the system. –  Triynko May 28 '13 at 15:16
add comment

4 Answers

up vote 7 down vote accepted

A pagefile will never increase performance, but it doesn't necessarily degrade it either (with proper memory management). Running without a pagefile, however, will only tend to increase your system's instability with respect to applications requesting memory that is not available for use.

Unless your OS is particularly bad at memory management, a pagefile with 6GiB of memory should see little use. That isn't to say it won't see any use at all; IIRC MS Windows is a bit crazy when it comes to paging things out even when there is plenty of memory available. (Why, I'll never know.)

However, what happens when you don't have the pagefile in use may be reason enough to enable it: hard crashes. Most apps expect to receive the memory they request. When they don't, they crash. (Ah, but the good-old-days of having to live in a few thousand bytes are gone..., and for all too many developers, so has the practice of dealing with memory management.)

If an app is built right, it'll fail nicely. (With luck, it'll not fail at all. But don't count on it.) With most apps, you'll have a fantastic failure on your hands. Furthermore, the more apps you have that come close to that limit, the more likely you are to see system-wide instability.

Case from my own experience. Windows XP, 4GiB, No page file. Perf was great. Until we started getting close to the 4GiB limit. Then things went nuts: apps would crash, menu items would only partially appear (or not at all), buttons would do nothing, etc. I switched back to the page file, even though performance was worse with it -- overall stability was simply better and more important.

Now, perhaps you don't use any apps or do work in your apps that would push 6GiB, but I can think of a few situations where you might get close: video editing, photography editing, audio mixing and production, etc. -- essentially anything where you are dealing with a lot of data (either working with, or streaming). When that data exceeds your memory capabilities, chances will be good that your app will just go "poof".

share|improve this answer
    
So, simply put (Yes/No): is it correct to say that, if I never use over 2 GiB of RAM, I will not see a performance boost? Or is there still a caveat somewhere, even with that precondition? –  Mehrdad May 21 '11 at 7:31
6  
No, a page file never improves performance. It only improves stability. Paging, by definition, is a disk-level operation, and disk operations are always slower than RAM-level operations. And, you are more likely than not, even with 6GiB (never exceeding 2GiB), that you will still experience some performance issues as Windows will still, frustratingly so, page unused processes out to disk. Whoever thought that was wise, I'd like them to 'fess up!) –  Kerri Shotts May 21 '11 at 7:34
    
Okay. Maybe it's because it's what I wanted to hear, I don't know, but I like your answer. :P Sounds pretty reasonable, thanks! –  Mehrdad May 21 '11 at 7:38
    
There are some tasks that cannot be performed without a page file on a given machine. For example, on a machine with P GB of physical memory: Running programs that combined require any {M∈ℕ|M>P} of virtual memory, etc. This isn't a matter of stability. Nothing will necessarily crash (for example, if all the current programs allocate all the memory they need in advance). However, when you try to run the one program that takes you over the limit, the operating system will simply fail/refuse to load it. No crash. It just won't work. –  conio Apr 29 at 17:15
    
Performance is not only measured as "high" or "low", but on a more fundamental level it is "existent" or "non-existent". For example, googling "define:performance" gives "an action, task, or operation, seen in terms of how successfully it was performed", which addresses the question of how well was a task performed, but also gives "the capabilities of a machine, vehicle, or product, especially when observed under particular conditions" which addresses the question of whether can a task be performed at all. Merriam-Webster simply says "the ability to perform". –  conio Apr 29 at 17:24
show 1 more comment

This article by Mark Russinovich will tell you everything you ever wanted to know about the page file.

I don't know if "cache" is the proper term to use with respect to what the page file does. A cache is a quickly-accessible temporary holding spot for data. An operating system "faults" things out to the page file when there is too much contention for physical RAM. So it's a stopgap for RAM overflow to prevent programs from crashing hard due to out of memory. But I do believe Windows tries to put things that haven't been accessed in a while in the page file (and Linux might do this too) so in that sense it is a cache, but not really its primary function.

Anyway, read the article. It will give you good guidelines on what to set your pagefile to. As @Sandeep Bansal says, there might be the occasional game that requires you to have one as part of a "requirements check" in order to run (but I don't know of any).

EDIT: This example can help you understand the role of the page file:

Let's say you have 512MB of RAM. You have a number of programs open, including a minimized browser itself consuming 250MB of RAM, and total RAM usage of everything running at that moment is 500MB.

So then, you start up another program (say a word processor) which wants to allocate 150MB of RAM. Out of memory. However, if we have a paging system, then the memory pages containing your minimized browser can be paged out to disk. So then the new program can load.

Now let's say you want to go back to the browser after a bit. Well, it needs to "page in" what it just sent to disk. If there's enough free RAM at that moment it can do that without a problem. If there isn't, something else has to be paged out first. If there's a lot of programs competing for the CPU and there is constant paging, then things get slow and you have the condition known as "thrashing." All this paging in and out causes slower performance, but it avoids programs from "hard" crashing due to out of memory errors. That is the purpose of the paging file. Too much paging, i.e. "thrashing" is likely no better than a program just giving up because it can't get any more RAM most of the time.

Now, you can see how if algorithms exist to anticipate what might not be being used at a given moment, then the operating system can "pre-page" things that it doesn't think will be used right away. So this accounts for Windows using the page file where it exists even if it does have enough RAM. It's trying to make as much RAM available as possible. Windows is like Linux where free RAM acts as a disk cache so if the balancing act is played right it can contribute to overall performance. This is all part of OS design and why it takes 10 years to get a good operating system out of thousands of programmers.

So, to actually answer your question as well, that is the only thing wrong with disabling the page file. Going back to the example I provided, without the page file you'd simply be unable to start your browser, or poorly written programs that aren't defensively programmed to anticipate OOM errors might act really strange.

share|improve this answer
    
@ultrasawblade: I still don't understand: The point of any sort of "cache" is to prevent a trip to the disk. If you're going there anyway, why not just grab the file from wherever it's located? What's the point of the page file? –  Mehrdad May 20 '11 at 23:46
    
@ultrasawblade: Also, regarding the article: It says, in general having [a page file] will mean more usable memory being available to the system. Wait, what? More available memory? Is > 3 GiB of permanently unused RAM space not enough? (Confused, since I rarely use over even 2 GiB.) –  Mehrdad May 20 '11 at 23:58
2  
The page files are NOT cache! If your ram gets full and you still want to make sure it still looks like your system has more available ram, then it will start copying data from ram to your disk (from processes that seem to be sleepy) so you still have available ram for your new processes! –  devoured elysium May 21 '11 at 1:41
2  
@ultrasawblade: The objection I have against your edit is that your example specifies a 97% RAM usage (500/512), whereas my example specifies a 33% RAM usage (2 GB out of 6). I was not asking about what happens if I get close to the limit; I'm already well aware what issues that causes. I was asking about what happens if you've still got quite a long way to go, where no thrashing or anything of the like would (should?) occur. If you can make the same argument for my case (6 GiB RAM, and 2 GiB being used) then that would be a lot better; otherwise, it simply doesn't address my question. –  Mehrdad May 21 '11 at 3:31
2  
+1 for the Russinovitch link. There's the answer. If you want to give up a safety mechanism to prevent possible crashing, that's your perogative. Windows will function just fine without the page file, unless it decides not to. ;) –  Kara Marfia May 21 '11 at 3:48
show 4 more comments

A page file isn't just for crash dumps to be stored, it isn't essentially made for that.

The page file exists so it can store data that RAM doesn't need to hold, it's like a cache for items that don't need to exist in memory thus providing more RAM for other things.

You're right that you may not need a page file if you have 6GB RAM, but you may need a page file for certain items, I remember that a few games require a page file and also it can be useful if there is one.

There's no harm in creating a 500MB Page File just to avoid problems if a certain process needs it.

share|improve this answer
    
But my question is: let's say I never use more than 2 GiB of RAM. Does enabling the pagefile give me a speed boost anyway? ("It doesn't hurt" is different from "Yes, it gives you a benefit".) –  Mehrdad May 20 '11 at 22:04
    
Well with 6GB RAM you won't notice a thing, even though there's RAM available the Pagefile will always be used for other things. I have 4GB, never really go above that. But I have a 1GB Pagefile just incase, like everyday PC's have 500GB+ HDD space now, so at least 500-1000MB won't be a loss –  Sandeep Bansal May 20 '11 at 22:10
    
@Sandeep: Hm... what exactly are those "other things"? The very reason I don't turn on the page file is that I don't understand why Windows would use the hard disk when there's so much RAM free, so I'm curious what those "other things" are. –  Mehrdad May 20 '11 at 22:11
    
It's the same as Linux, why does Linux use swap space when it has RAM to access. The pagefile holds files that haven't been used for a period of time away from RAM. –  Sandeep Bansal May 20 '11 at 22:35
    
@Sandeep: I have no idea why Linux does it either, same difference for me. What's the point of holding files in the pagefile though? If they're not in RAM, why not just read them from wherever they're actually located on the disk? –  Mehrdad May 20 '11 at 22:36
show 10 more comments

The first step is to understand what a Cache is, or rather, what the different caches are used for.
The CPU has a small internal cache which allows it to store OP results, flag states, and calculated addresses. On a dual core I believe that internal cache is about 1mb. It's is extremely fast, only accessible by the CPU internals, and the most affected by heat in an overclocked CPU.

The level 2 cache acts as a high speed buffer for CPU to Memory transactions and also holds code threads collected by prefetch. On a dual core I believe a tyical installation would have 6mb of lvl2 cache. It is very fast, though slower that internal cache memory, is accessible only to the memory controller and CPU, and resides on a dedicated line on the bus.

A page file is indeed a cache, in that it stores data which may or may not be present in memory. An O/S can use the paging file for various tasks, one of which is to save the current state of a data file that has not yet been committed to disk. When a pagefile does not exist, it is up to the third party application to provide this functionality internally. The trouble with this scenario is that many programs do not behave well when it comes to garbage collection, and you are left with spurious .temp files being left on your disk. These remnants are not part of the installation manifest and can hinder an uninstall procedure and also degrade disk access speed.

My opinion is that a swap file is normally a good thing to have. Indeed, if your system is highly populated with Ram and it is dedicated to 1 specific task, and that application takes care of all these things then a swap file may not be needed. One example may be an Arcade Video Game that runs on the windows platform, these are typically installed with only the drivers needed for the devices present and are not likely to suffer from driver contention. For the most part though, most applications do not take care of all the potential issues that could arise and especially those that include impact from other third party applications and driver contention.

Though you may notice a low to moderate decrease in performance in the shortterm of adding a pagefile, longterm the performance should remain consistent. Not having a pagefile may seem faster in the beginning, but over time performance will degrade considerably.

Steven Malm, MCP.

share|improve this answer
    
"When a pagefile does not exist, it is up to the third party application to provide this functionality internally." --> Not quite sure what you mean; programs don't really care if there's a page file there or not. –  Mehrdad May 22 '11 at 18:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.