From owner-freebsd-current Tue Apr 13 13:19:28 1999 Delivered-To: freebsd-current@freebsd.org Received: from phk.freebsd.dk (phk.freebsd.dk [212.242.40.153]) by hub.freebsd.org (Postfix) with ESMTP id 88D6914CED for ; Tue, 13 Apr 1999 13:19:19 -0700 (PDT) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (critter.freebsd.dk [212.242.40.131]) by phk.freebsd.dk (8.9.1/8.8.8) with ESMTP id WAA25479; Tue, 13 Apr 1999 22:17:00 +0200 (CEST) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.9.2/8.9.2) with ESMTP id WAA13881; Tue, 13 Apr 1999 22:16:58 +0200 (CEST) (envelope-from phk@critter.freebsd.dk) To: mi@aldan.algebra.com Cc: dillon@apollo.backplane.com (Matthew Dillon), current@FreeBSD.ORG Subject: Re: swap-related problems In-reply-to: Your message of "Mon, 12 Apr 1999 11:05:21 EDT." <199904121505.LAA70241@misha.cisco.com> Date: Tue, 13 Apr 1999 22:16:58 +0200 Message-ID: <13879.924034618@critter.freebsd.dk> From: Poul-Henning Kamp Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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