kernel killing processes when out of swap

Marc Olzheim marcolz at
Tue Apr 12 07:26:41 PDT 2005

On Tue, Apr 12, 2005 at 03:06:41PM +0100, Nick Barnes wrote:
> The right choice is for mmap() to return ENOMEM, and then for malloc()
> to return NULL, but almost no operating systems make this choice any
> more.

No, the problem occurs only when previously allocated / mmap()d blocks
are actually used (written) and when the total of virtual memory has
been overcommitted: Physical pages are not allocated to processes at
malloc() time, but at time of first usage (Copy On Write).

A possible solution would be for the kernel to only hand out memory
allocation-time when it's possible to back it up with virtual memory,
but normal memory usage allows for overcommits just fine and many
programs have been programmed in a way that assumes this behaviour, for
instance by sparsely using large allocations instead of adding the
possible extra bookkeeping to allow for smaller allocations. It just
makes a lot of memory allocation / duplication issues a lot easier...

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url :

More information about the freebsd-stable mailing list