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

From: Arjan van de Ven
Date: Tue Nov 25 2003 - 09:02:48 EST


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: signature.asc
Description: This is a digitally signed message part