malloc does not return null when out of memory
Muttley
muttley at nildram.co.uk
Thu Jul 24 08:59:32 PDT 2003
Yes, I thought briefly about something like this.
Then I thought 'there's a race condition'.
Then I realised that other processes might not link against this
malloc.
Then I realised the race condition doesn't even matter; processes will
still be killed, as the kernel doesn't care that you're still in
malloc() when the overcommitted memory is touched, it just knows
you've touched it and there's no actual memory there. This will result
in far more processes being killed. I believe that's a bad thing.
Any patch for this is going to have to be in kernelland not userland.
Cheers,
Matt
From: "Chuck Swiger" <cswiger at mac.com>
Date: 24/07/03 15:16
I don't think the following is a particularly good idea, as the
existing prezero
('Z') or junk ('J') options will also serve to reference memory and
prevent
the "memory overcommit issue", but:
<patch to touch memory just after it's sbrk'd>
More information about the freebsd-stable
mailing list