>> malloc just moves the brk, but the backing pages don't get
>> allocated until the pages are accessed (during memset).

"erik quanstrom" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> i'm just suprised that plan 9 overcommits.  this makes
> this code nonsensical from user space
> if((p = malloc(Size)) == 0)

Indeed, when I discovered that Linux was overcommitting memory
in much the same way, which in my view is erroneous design, I
added an optional feature to my portable malloc implementation
that (on systems neeing it) would touch every allocated page
before reporting success.  (During the touch loop a trap catcher
would set a flag that would be tested after the loop to determine
whether there had ben any faults.)  malloc really shouldn't have
to do this, but if you're insisting on overcommitment in the OS
then the library malloc() needs to do it.  Otherwise, applications
that try to be careful may still fail "randomly", which is intolerable.

Reply via email to