[clug] to swap or not to swap that is the question

Martin Pool mbp at sourcefrog.net
Tue Jun 29 23:39:03 GMT 2004

On 29 Jun 2004, Sam Couter <sam at couter.dropbear.id.au> wrote:

> Running out of memory (including swap) is BAD BAD BAD. It causes much
> non-deterministic behaviour for many reasons. Lots of programs and
> libraries don't deal with malloc() failing, so programs crash. Linux
> will overcommit memory by default, so even if malloc() succeeds, when
> you try to address the memory it may not physically exist.

Overcommit implies that malloc failure is pretty much unrelated to
running out of VM.  It means that the particular process couldn't
allocate more space.  For example trying to malloc 3.5GB on i386 will
probably fail even if you have 64GB; trying to malloc 1GB will
probably succeed even if you have 128MB.

> Linux also has an OOM killer which will pick the largest running
> program and unceremoniously kill it. So Bad Shit (tm) will happen.

I think the default behaviour is to kill whoever provoked the page

The main point of swap these days is to give you a soft landing.  If
the machine uses too much memory it will slow down rather than killing
things straight away.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.samba.org/archive/linux/attachments/20040630/09b7b0f1/attachment.bin

More information about the linux mailing list