Re: 2.2/2.4/2.6 VMs: do malloc() ever return NULL?

Arjan van de Ven
2003-11-25T14:00:58Z

[-- Attachment #1: Type: text/plain, Size: 856 bytes --]

On Tue, 2003-11-25 at 14:27, Ihar 'Philips' Filipau wrote:
> Hello!
>
> I just wondering: do last three stable branches of LK able to return
> malloc()==NULL and/or ENOMEM?
>
> 2.2: I cannot test this stuff right now - but it was hanging hard on
> "for (;;) memset(malloc(N), 0, N);" So we do not have NULL from malloc().
> 2.4: same behaviour if OOM disabled. But by default (OOM even has no
> configuration entry - so always on) it just kills offending process. No
> NULL pointer either.
> 2.6: the same as 2.4 with oom killer (default conf). I have no test
> system to check 2.6. w/o oom killer.
>
> Resume: we malloc() never returns NULL. so man-pages are incorrect ;-)

that is due to the overcommit policy that your admin has set.
You can set it to disabled and then malloc will return NULL in userspace

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]