On 2004-05-08 15:13:40 +0200, Wolfram Gloger wrote:
> But now concerning the bug report in question: I see no bug.  The
> MAP_NORESERVE does not matter here at all.  Note that before malloc
> hands out memory in a region allocated with MAP_NORESERVE, it _must_
> call mprotect(..., PROT_READ|PROT_WRITE) on a smaller subregion, and
> _that_ call definitely should be checked by the kernel against
> overcommitment accounting, as _then_ (and only then) physical memory
> really is potentially allocated.  I believe this to be the case in
> Linux.

But mprotect seems to be never called (strace just shows old_mmap
calls).

> In general, if you want malloc to return NULL on Linux in a controlled
> way, the best advice is to use "ulimit -v" IMHO.

No, this is really a very bad idea, as this would limit the virtual
memory, instead of checks being done dynamically. And the memory will
quickly be exhausted. Well, unless ulimit does something special, I
don't see how it can be used to globally solve the malloc problem in
practice.

-- 
Vincent Lef�vre <[EMAIL PROTECTED]> - Web: <http://www.vinc17.org/>
100% validated (X)HTML - Acorn / RISC OS / ARM, free software, YP17,
Championnat International des Jeux Math�matiques et Logiques, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA


Reply via email to