Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Apr 1999 22:16:58 +0200
From:      Poul-Henning Kamp <phk@critter.freebsd.dk>
To:        mi@aldan.algebra.com
Cc:        dillon@apollo.backplane.com (Matthew Dillon), current@FreeBSD.ORG
Subject:   Re: swap-related problems 
Message-ID:  <13879.924034618@critter.freebsd.dk>
In-Reply-To: Your message of "Mon, 12 Apr 1999 11:05:21 EDT." <199904121505.LAA70241@misha.cisco.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
In message <199904121505.LAA70241@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
phk@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 majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?13879.924034618>