In message <199904121505.laa70...@misha.cisco.com>, Mikhail Teterin writes:
>Matthew Dillon once wrote:
> 
>>     If you unset the datasize limit and the program does not exceed
>>     the maximum system-supported datasize limit, malloc() should not
>>     return NULL even if the system is out of swap.
>
>Can you explain why? Our malloc(3) is a little fuzzy as to the
>circumstances under which malloc will fail, but on Solaris, it is
>more explicit:
>
>       RETURN VALUES
>               If there is no available memory, malloc(), realloc(),
>               memalign(), valloc(), and calloc() return a null pointer.
>
>I consider being out-of-swap as having "no available memory". Wouldn't you?

The trouble is, there is no such thing as "no available memory".

What we have instead is "not enough memory available for this specific
request".

For phkmalloc I can say in particular that there is a pool for each
size of chunk (16,32,64...2048 bytes and for pages.  If you run out
of one of these there may still be stuff in the other pools.

--
Poul-Henning Kamp             FreeBSD coreteam member
p...@freebsd.org               "Real hackers run -current on their laptop."
FreeBSD -- It will take a long time before progress goes too far!


To Unsubscribe: send mail to majord...@freebsd.org
with "unsubscribe freebsd-current" in the body of the message

Reply via email to