Quick question (or maybe not)
I often see people advising to have swap file space of double the amount of RAM you have (think it's double).
Why is this? I find that the more RAM I have, I need a smaller swap file, if I had 512Mb of RAM I would expect to need a decent sized swap file because the amount of RAM isn't large enough to run the numbers of programs I use.
With 2Gb of RAM I have plenty of RAM to run all the programs I run, so why would I need a 4GB swap file, heck I don't even really need a swap file.
Same goes if I have 4GB of RAM, in that case I REALLY wouldn't feel like I need a swap file because I have plenty of RAM for anything (and everything) I want to do.
Am I missing something here?
-
Congratulations, you have a working brain!
(Always surprises me how few people manage to make the connection that "If I have more RAM, I need less swap space", even though they know the point in swap space is to cover for when you run out of RAM)
Yes, you are absolutely right. it is nonsense to say that your swap file should be X times as big as your RAM.
The exact inverse is true. The more RAM you have ,the less swap space is neccesary.
(That said, you should always have a swap file, even if it's never used, and even if you just make it 128MB) -
I currently run without, the only "issue" is that if Windows DOES run out of memory (I refuse to say virtual despite that being what Windows says since I don't have any virtual memory I only have real memory) because of the poor management of memory in windows it CAN be a pain to try to close a window to get memory back to (windows seems to try to use a swap file, and grinds to a halt realising that the swap file doesn't exist). -
So yeah, you certainly do have virtual memory. The pagefile is only a handy side-effect made possible by virtual memory.
(And yes, there's another reason not to disable it. 2GB RAM may sound like a lot, but it may be used up before you know it. One problem can be memory fragmentation. If you're low on memory, or if lots of processes have been running for a long time, your memory may be so fragmented that memory allocation requests can't be handled. Then applications will crash (maybe they'll crash gracefully, but they'll still close down). -
For normal day-to-day applications 2GB is enough to run without a page file, but if you run multiple large applications (Data base/web or any type of servers, New games, large multimedia processing applications etc..) then even 2GB wont be enough. -
-
I should have known better
; with 1300+ posts you should really know your stuff
Anyways in this article the writer argues that by disabling page file you may end up using more system RAM than having a page file. But in my experience no page file definitely makes things faster. And 2GB is enough to turn it off safely without getting any memory errors. -
I'd recommend against disabling the page file. I've had issues with some programs basically requiring that you have a paging file or they won't work. I believe it was Photoshop or AutoCAD or something, and it was a couple of years ago, but it still stands as the system hasn't been reworked significantly since then. The system wasn't running out of memory, still plenty of RAM left, but it just wouldn't start until I re-enabled the pagefile. I normally set my swapfile (with 2GB of RAM) to 512MB, and let it expand as necessary. I haven't had it expand yet.
-
You may notice Windows using your pagefile even when it isn't strictly neccesary (Occasionally accessing it a little bit, even with 2GB RAM, and even if you're only using, say, 1.2GB memory). And yes, that may seem like a performance loss. There's a good reason for it though.
Windows tries to keep a good chunk of RAM free at all times by *gradually* moving unused data to the pagefile. This gives a marginal (and usually unnoticeable) slowdown, and sometimes, if you're unlucky, it may have to read that data back from the pagefile.
However, the alternative would be far worse.
Imagine if it didn't use the pagefile at all until the RAM was full.
Then the game you're running starts loading a new level. Oops, that requires 200MB of RAM, but the RAM is full. Now Windows has to write a full 200MB to the pagefile all at once, before your game can even start loading! Any guesses for how long that'll take? 30 seconds, maybe?
*That* is a performance loss you'll notice. So Windows' strategy makes much more sense, of occasionally stealing a millisecond or two to write unused data to the pagefile. Just so it's prepared for sudden large memory requests. (Of course, if you disable the pagefile entirely, it's forced into the first strategy, and if it does run out of memory? Well, applications will just start crashing. Now we're trading stability and robustness for a marginal and unnoticeable amount of performance, which I don't think is a much better strategy)
So in the long run, I'd argue that Windows' strategy *improves* performance quite a lot. (Btw, I've seen that article before, and the guy definitely knows what he's talking about. It's a very good read. -
Yes, it was Photoshop, but I don't think CS2 has that problem anymore.
-
Well, it is a general observation I have made over the past few years. I normally have several windows open at a time (minimized), like couple of Windows explorers, MS Word, several Browser instances, email client maybe one or two chat windows etc.. It is noticeably faster to switch between them when there is no swap file. Try this and you'll see what I mean.
I agree that if you run out of memory in the middle of something then you are in trouble, sometimes it may even cause data loss. But 2GB is plenty of RAM to be able to safely turn off the swap. I've been doing it for a long time and never have run in to any serious trouble (I turn it ON sometimes when i fear that it might be needed, but only on rare occasions). As I said in my previous post turn it off if you don't run large applications concurrently. -
-
But it's more an interesting topic for discussion. The one place I've noticed MUCH faster performance is startup and shutdown without a pagefile, both are much better.
Thanks for the information about virtual memory too, guess I learn something new every day. -
I have not really compared how it is with a very small page file Vs NO page file, but with 2Gb RAM Windows should be smart enough to use a small page file without us telling it (assuming that windows is smart
). So I'm guessing there wont be much of a difference between letting Windows manage it and us specifying a small size. (OK…. there may be a small difference, but that wont be as much as running without a page file)
More than the boot up and shutdown you will notice it when switching between apps, login back in after you leave the PC for a while, or invoking the start menu, among many other things (that you do for the second time; since there is no hard disk page file there is no place for Windows to keep them except in the main memory). These delays are more evident especially when your system drive is slow or when you run nonstop for several hours.
I don’t meddle with the swap file in a regular basis, I have had it very few times, I recall having it once when I was doing a project that involved in running a database and web server, and another time when I was doing some serious photo editing stuff with many photo editing apps open at the same time.......I think over the past year I may have turned it on 5 times at most. Every other time it is disabled.
I can safely run one or two Visual Studio 2005 IDEs (for compile and debug), couple of office applications, email client, Firefox with multiple tabs, several IM clients, Winamp, and few other small programs without a page file.
Even NFS Carbon runs. So I think it is quite safe.. -
*Shrug* It's your data loss, not mine.
And no, I thnik using a small page file may produce different results from using a large one. With a large one, Windows obviously has more room to play around with, so basically, it can try to stay prepared for bigger workloads (2GB RAM and 2GB pagefile gives WIndows 4GB to play with, which means it's able to handle 4GB workloads, and so, it can prepare for this by gradually pushing data to the pagefile. With, say, a 64MB pagefile, there's no point in preparing for a 4GB workload, because it only has just over 2GB of virtual memory available. -
Jalf, TY for great info, as I am still learning more specifics all the time. I think it makes more sense to me now knowing more about what F R E D is doing.
I thought MS Win used 1.5x RAM for the page file by default, but the user could select; NO PF, System Managed, or direct when & how much PF to have. {* PFUH flat @ 296 MB as I typed this; 7 windows on Task Bar=Skype, 5 Ffox [=23 screens total], W T M * )
But by not following Win recommended sizes always resulted in getting warnings / notifications of `Virtual Memory ....'
P..Fx how do you stand looking @ the warnings all the time, or is there a way to turn them off?
Default SWAP file by many GNU/Linux partitioners is the old recommended virt mem =2x RAM from the days of MB measurements for total RAM. Newer bundles seem to default to =RAM (oSUSE, FC, Ub/Kubuntu) but Mandriva still defaults to 2X. (Forgot what Slack 11 does!)
As I am trying to get maximum use out of my HD while experimenting w/ xp PRO, vista ULTIMATE, and various GNU/Linux bundles.
1. HD transfer rate bench mark graphs always show faster MB/s early on the drive (unless RAID, but rare in a notebook, so ignored in this thread!)
2. Most recent Linux tries to place SWAP early on hd.
So, I make 3 Primary partitions; boot-Page File {FAT} (Win=3.2GB), then a 4GB SWAP, then xp PRO {NTFS} (~6GB). In the extended part I make logical drives for all the other stuff. root parts, shared home directories.
Please realize I do not have much data except for all the articles I saved to learn from. Intend to make a D V E machine eventually (MS/GNU) or buy Mac!
I tried designating b-PF as a shared space for xp PRO or ULTIMATE to use (depending on which I booted. [Do not know enough yet to play w/ VMware or run an OS virtually, but getting there]. Seemed to work, but as vista still growing / developing (aka beta2, updates & RC1) I never finalized anything that satisfied me. I only remember I designated PF size & location in vista 1st, then told XP to use system managed where it was as I recall.
GNU/Linux always seemed to recognize my SWAP part, and use it fine by default, unless I was loading Mandriva free 2007 (Gave up on this bundle for now!).
Next project is SHARING the virtual memory space between MS & GNU, so that I can delete one of the primary parts I currently format during an install.
Maybe install Tiger there??
I can only keep a maximum of 36 Internet Explorer (6) windows open before it justs stops opening more, but did not see much growth in `Page File Useage History' size in Windows Task Manager-Performance tab. ( * *) = 1st para
Different story with Opera 9.2 or Moz FFox, there I did see growth in PFUH!
Could keep many more browser windows & tabs open, total screens >200.
Asking why so many screens? I open stuff while online [eBay, forums, news, tech deals] then left library, went home (NO Inet) & read for few hours! -
You can't share swap space between Windows and Linux. Windows uses a specially formatted page file, and Linux uses a specially formatted partition, and never the twain shall meet.
-
Actually, it is possible. Linux can use a FAT32 partition for swap. And Windows can be told to put its pagefile a on FAT32 partition too. You have to fiddle around a bit to make Linux reinitialize its swap partition every time it boots, though. But there are a few guides about it on the net. I can't see much point though. You save what, 1GB of disk space? Big deal
Windows Swap file size
Discussion in 'Windows OS and Software' started by Arla, Jan 24, 2007.