Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want my Windows to run as fast as possible. If I have 12GB RAM in Windows 7 64bit, quad core CPU, and all apps fit in memory, will the swap file ever be used for anything? The question is about if it's a good idea to put the swap file in a RAM disk.

Would a RAM disk help in any way or will Windows intelligently use all the available memory for all its work?

I am also thinking of putting the temp folder on a RAM disk. I know the RAM disk is volatile memory and I don't care about its content if it gets lost.

share|improve this question
The title made me laugh a bit, but actually your if [..] all apps fit in memory, will the swap file ever be used for anything is quite a good question! – Arjan Jun 5 '10 at 17:12
The pagefile - it's not a "swap file" - will be used as necessary to allow programs to allocate virtual address space beyond what RAM alone would allow. This is necessary even if, after allocation, they only actually use as much as would fit in RAM. – Jamie Hanrahan Jun 27 at 2:44

10 Answers 10

I agree that putting the swap file on a ramdisk doesn't make sense for a 64-bit OS. However, if one has 32-bit WinXP, then Windows can only "see" the first 3.5GB of RAM. If one has more RAM, say, 9GB, the RAM above 3.5GB is completely wasted by WinXP. However, using a program such as SuperSpeed RamDisk Plus, one can use the memory above 3.5GB as a ramdisk - and putting the swap file up there makes a tremendous amount of sense (again, on 32-bit XP, not 64-bit Win7).

Separately, putting temp files in a ramdisk almost always makes sense, performance-wise, unless the anticipated size puts too big a dent in the RAM available to the OS.

share|improve this answer

Putting the pagefile on a ramdisk is a ridiculous idea. You have to understand that only a fraction of total paging will involve the pagefile. Most paging will be with executable and other mapped files, and a pagefile in RAM will do nothing to improve this performance. And thanks to the reduced system ram available there will be more of this paging. The result is that pagefile access will be faster but overall paging levels will be higher with a reduction in performance.

share|improve this answer

I would not say ridiculous; for neither 32 or 64 bits systems.

To start with the obvious, 32 bits windows (the majority of running systems) simply ignore anything above 4GB. Ramdisks being able to use PAE and 36 bits memory addressing, they are to my knowledge the only way of making high memory areas useful in 32 bits systems.

Question is : how do we make use of a lightning fast / more secure virtual hard disk ? Temp files come to mind and are pretty trivial to setup, as long as you know how to assign a fixed drive letter in Windows. Same with browsers cache. The interest for these is quadruple :

  • Fastest access/retrieve
  • True deletion
  • Suppresses most of useless wear on expensive SSD memory.
  • Less disk fragmentation..

As for the swap file, it seems obvious that 32 bits systems have a lot to gain with putting them in unclaimed RAM. One could think of a memory hungry program, using up to 3 GB on itself (with the 3GB switch in boot.ini) that will most likely cause a lot of swapping. Two of the same bonuses still apply: true deletion and wear on SSD. Fragmentation is less of an issue with swap files.

There is more : it is quite common for poorly written programs to use virtual memory, no matter how much physical memory available, causing useless disk access. This holds true for both 32 AND 64 bits programs. I even came across programs that will just fail to launch in the absence of a swap file.

Bottom line, while it makes sense no matter what to have a ramdisk below 4GB and save useless disk access for temp folder and programs caching, it seems much preferable to install more than 4 GB, memory price being what it is, in both 32 (with PAE enabled hardware) AND 64 bits systems and move the swap file there.

One should note that A LOT of professional computer users still can't go 64 bits for hardware support reasons.

What would be ridiculous, to use the same strong language as above, would be to just dismiss the idea and rely not only on Microsoft's virtual memory handling (which is praised and rightly so) but also on application programmers who range from the assembly coding guru to the high level language idiot that will bring the nicest-most-stable-PC to its knees just through bad memory handling. I've seen such code in mainstream programs, productivity applications, I kid you not !

My main system has a 8GB ramdisk on XP/32 and this has proved useful. It's quite trivial to setup and I must say the only program that gave me a hard time is google chrome whose installation/update strategy is hard on the tweaker.

You can think of a lot of useful use for ramdisks apart from these ; in my case, audio samples to retrieve from disk on live applications : put them there at bootup time (painfully slow) and get lightning fast access to multiGB libraries. But this is way off topic :)

This is my own experience. I wish people would not destroy the value of useful information by the use of unnecessary strong language. Ridiculous was a bad choice of word in this context, to say the least.

share|improve this answer

Yes, paging files are used even if one has lots of RAM; but the simple existence of a paging file is not by itself a factor affecting system performance. Putting a paging file on a RAM disc is daft, moreover. The point to a paging file, after all, is to be a place for holding (transient) page data when those data are not currently in RAM. RAM discs are in RAM …

Placing temporary files on a RAM disc is a wholly different kettle of fish, of course.

share|improve this answer
That post doesn't explain why the OS needs to page out anything if the system has tons of ram and can hold EVERYTHING. The whole point of paging is to make room for more important processes but if memory can hold transient and new and old and seldom used and anything in memory why not keep everything in ram? As for dumps, I don't care about them. I can't read or understand them so they might as well get deleted and don't bother saving them, unless I send them to MS for analysis. – Tony_Henrich Oct 13 '10 at 16:41
The other article it refers to also have the usual strawman: "some" programs "may" fail, without ever specifying which programs that actually are, or how they may fail. – RolKau Dec 1 '10 at 22:33
@Tony, crash dumps are difficult for a normal person to read and interpret, but if you install Microsoft's debugging tools, they can be quite informative in figuring out why a BSOD occurred. If your computer never crashes, then of course it's irrelevant, but I've found crash dumps extremely helpful in troubleshooting crashed computers in the past, so don't dismiss them entirely. – nhinkle Dec 20 '10 at 4:15
@Tony_Henrich "why not keep everything in ram" => because if there's somethign that's never (or very rarely) accessed sitting in RAM, it's wasting that space. That space could be better used to cache files that are accessed often, providing a net performance boost. Any physical RAM space not actively used by program code or data can be used by the OS to cache files - which is also why it's not a good thing to be running near your total RAM capacity. – Bob Jul 8 '14 at 0:49
Most people who claim "the system has tons of RAM and can hold EVERYTHING" have never looked at the total virtual address space usage on their machine. – Jamie Hanrahan Jun 27 at 2:00

I doubt you would see much difference moving your pagefile to ramdisk. If you wanted to force windows to use ram you could turn off the paging file.

However I noticed a large difference moving my IE temp files to a ramdisk and setting my TEMP and TMP enviromental variables to point to the ramdisk.

I also run Google chrome with the flag "-user-data-dir="R:\ChromeTEMP" so it stores temp files on the ramdisk. This will cause it to forget your settings. But since I use the sync feature it didn't effect me much. After the initial sync everything was back to normal. And skyrim loading screens are shorter after linking to copies of some files on my ramdisk.

share|improve this answer
Getting rid of your pagefile (or putting it on a RAMdisk) does not "force Windows to use RAM". There are hundreds of other files used for paging and Windows will still be paging to and from those. – Jamie Hanrahan Jun 10 at 20:28

Windows will continue to use the swap file, which (much to my confusion, since I have an identical setup) didn't make any sense to me. However, after disabling the paging file, I saw no real performance improvements. I've since gone back to using a page file, since windows uses it for things other than virtual memory (I think it also writes crash dumps to it, when you bluescreen) which I need. I've also blown through my 12GB of RAM several times, and was thankful I had the wiggle room.

In short, Windows will still use the page file, but you shouldn't notice it as a performance hit.

As for temp files, moving those to a ram disk should increase their access speeds, though make sure that you won't need anything in there to persist through a reboot/crash and that the ramdisk driver loads and creates the ramdisk before any applications or the system needs to use the temp folder.

share|improve this answer
I think mini dumps are saved in some special folder under Windows. I am not sure about full dumps but maybe they get saved in the page file. But I don't mind putting a page file in any non root drive. I just hope Windows is efficient enough to use available ram as much as possible and use page file only when absolutely necessary. – Tony_Henrich Oct 13 '10 at 16:45
@Tony: They get saved in the page file until you reboot, at which time they get saved to the Minidump folder under %SYSTEMROOT%. – Hello71 Oct 15 '10 at 1:18
MS states that the disabling the swap file will most likely decrease performance even in high memory systems. The OSs memory management is designed around swapping. – Keltari Sep 13 '12 at 6:07
Note that it is possible to make Windows prepare crash dumps in a dedicated file instead, which avoids the requirement that there be sufficient freespace/pagefile on the system drive to store the dump data; see How to use the DedicatedDumpFile registry value to overcome space limitations on the system drive when capturing a system memory dump - Ntdebugging Blog – SamB Sep 17 '15 at 18:40

It is actually not a bad idea in my opinion.

Logically, people misunderstand "page file" or more correctly "swap file" as RAM. It is true that the swap file holds similar data as RAM holds. But Windows does not use this like RAM. As you see today in the growing multitasking world we live in, Windows was designed back in the day to handle the limited amount of RAM by constantly writing between swap file and RAM.

The swap file is always used by Windows since the performance gain is more noticeable on older slower computers with few programs running. As you open a window, the program gets swapped into RAM, as you are working in it.

Let's say you're writing a letter in Word. If you have just started that program with many programs\windows in the background, it tends to be slow, but then runs smoother after a few seconds. Then, when you switch to Internet Explorer, it runs slow, then gets faster because it was in page file and then swapped to RAM, while all background processes get loaded into the page file.

Now let's introduce the RAM disk to Windows. Put the swap file on the ramdisk instead of the HDD and you have improved the ability for Windows to multitask, since RAM is faster than the HDD/hard drive. However this won't help on an older system unless you buy a physical RAM drives – and you may have to set the pagefile again in Windows as without power it will be deleted.

Pagefiles get very pointless for newer PCs with 8, 16, 32, 64 Gigs of RAM.

share|improve this answer
The question is still why would Windows swap out anything if there's plenty of memory to hold everything. it's not like memory 'gets tired' from holding the apps and needs a break. – Tony_Henrich Oct 13 '10 at 16:48
Er, actually, "page file" is more correct than "swap file"; technically, swapping is where you send ALL of a given process's memory to secondary storage... – SamB Sep 17 '15 at 18:26
Why: because it is agressive about trimming back the "working set". But it's not really swapped out, and is pulled back when needed without having to read the disk. – JDługosz Oct 12 '15 at 7:34
"the swap file is always used by Windows" - incorrect. Even if it does happen to use the pagefile, it writes things there that it's decided, for good reason (like you haven't touched it for a long time), that it's not worth keeping it in RAM. Why do you think you have more information about what to keep in RAM than Windows does? Anyway, as others have said, putting a pagefile in RAM is like giving yourself a loan and then paying yourself back from the loan proceeds. You don't have any more money, you've just spent a lot of useless effort. – Jamie Hanrahan Jun 11 at 19:22

Most of you sceptic guys forget the 32-bit Windows RAM limit and miss the fact that you can't put there more code & data into RAM, than the 3,5GB. Or, you just believe we're trying to "cut off" say 2GB out of the accessible 3,5GB - for fast pagefile, with the cost of reducing available memory down to 1,5GB. This is certainly pointless, but that's not our idea. Our idea is dedicated to the users of 32-bit Windows, who own PCs with MORE RAM than that nagging 3,5GB limit. For example, a machine equipped with 8GB, running 32-bit XP or Vista or 2003.

When you work hard with many applications simultaneousely, the system often faces condition of exhausting memory. To avoid critical error system is forced to store some data of background-running applications to pagefile. Typically it means writing tens and hundreds of MB on the hard disk. And remember - it happens often, when you really make use of multitasking (nowadays common, as well as memory-consumming apps). And when you get a background app to foreground - another batch of data from RAM must go to HDD, just to make space in RAM for previous batch to come back from HDD (this time writing and reading many MBs from disk drive). Just observe your red HDD activity LED - it lights more than stays off (your HDD works really hard).

Now imagine all of these operations redirected to EXTRA RAMdisk (extra RAM, beyound the system's operational memory area which remains the same in size - maximum).

  • This way it works 1000 times faster (RAM operations compared to HDD) so time of swapping becomes marginal;
  • Your HDD works way less than typically, it gets quiet, cool and the lifetime extends remarkably.

I disbelieve it would be pointless in terms of performace, not to mention hard drive reliability.

OK, most machines built in the XP era weren't based on mainboards capable to support more than 4GB of RAM. So I understand there are few guys out there who really care/need and understand the idea. But now...

WELCOME TO THE VIRTUALISATION ERA! More and more of you are lucky to own a machine with plenty of RAM. A newbie can configure his host system to assign 4GB to the guest 32-bit Windows, and still have lots of RAM. It would be really precious then, to enrich it with a 4GB RAMdisk, assigned to the same guest OS, dedicated for pagefile with no cost of guest's RAM space!

A server I supervise has 12GB. Instead of buying new system (64-2008 plus CALs!), I could assign 8GB for guest - virtual 32-2003 and try testing software RAMdisks. However I don't trust them as they seem to be hacks and I don't like taking chance on stability. This is why I'm looking for a solution to prepare my host's Linux Ramdisk as a blockdevice and format it to FAT or NTFS in order to make it acceptable for guest OS's virtual disk, to put pagefile on it. I believe my server would boost and save lots of disk effort.

Where am I wrong? Greetz!

share|improve this answer
Good point about virtualization, but without virtualization, a ramdisk doesn't let you access more ram than you can address normally. Without PAE, that is about 3.5 GB, but NT 4.0, win2k, and the pro/server editions of xp support PAE, enabling up to 64 gb of ram. Given that you can use all of that ram, it is better to let the system use it how it sees fit, including for caching files, rather than allocating it to a ramdisk, which limits the system to only using it to hold swapped private pages, which does not include program files and cached file data. – psusi Aug 7 '12 at 0:21
This sounds like a rant. – bwDraco Sep 29 '12 at 19:09
If the OS has decided a particular set of data is not worth keeping in RAM, rather putting it in the pagefile... why do you think you have enough information to justifiably say "no, keep it in RAM anyway" by putting your pagefile on a RAMdisk? – Jamie Hanrahan Jun 10 at 20:26

In regards to the temp folder, moving it to a ramdisk would increase speed.

However there are things to note:

  • loss of power would mean loss of data
  • not every application uses the temp folder provided by Windows, some use their own
  • if the temp folder ran out of space, applications or Windows might crash
share|improve this answer

Ramdisks are useful for things like fast internet cache of IE, Chrome, and Firefox etc.
Putting the pagefile on a Ramdisk in a 64 bit system is useless.

DisablePagingExecutive might better suit those needs. But putting the pagefile on a Ramdisk in a 32 bit environment with more than 4 GB of Ram is a huge improvement. However, if your computer is a single core processor (only one according to the taskmanager), there will be improvement (can't remember exactly how much , it has been a while). But you also need to set ClearPagefileAtShutdown to get rid of the error on next reboot because the pagefile won't be there.

The best use for a Ramdisk that I can think of is to mirror your program files folder (or select programs) into the Ramdisk.

share|improve this answer
DisablePagingExecutive only disables paging of the executive. Paging of eveything else that would normally be paged still happens. – Jamie Hanrahan Oct 13 '15 at 4:27

You must log in to answer this question.

protected by Community Oct 5 '15 at 17:30

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged .