
Leigh Sharpe wrote:
Hi All, I'm about to set up a new linux box, but not all of the bits have arrived yet. I currently only have 512MB of RAM in the machine, but ultimately, it will have at least 2GB, possibly 4. If I let the installer do it's own thing with HDD partitioning, it will set up a swap size of 2 x RAM. But that's not what I want. 2 x the current amount of RAM will be inadequate once I install more.
AIUI "twice the RAM" is advice for pre-Linux unices that did something particularly dumb -- maybe stop-and-copy paging or something. IMO, the Right Thing is to 1. no swap. If you need 2GB of memory, buy 2GB of RAM; 2. no RAM overcommit. This means malloc returns an error rather than handing the problem over to the OOM killer. 3. fix any programs that make inappropriately large, up-front mallocs; likewise those that do not handle errors from malloc appropriately (even if "appropriately" means asserting malloc success). Obviously this advice is inappropriate in some contexts - varnish obviously springs to mind.