From owner-freebsd-hackers Sun Sep 21 21:12:00 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id VAA08628 for hackers-outgoing; Sun, 21 Sep 1997 21:12:00 -0700 (PDT) Received: from kithrup.com (kithrup.com [205.179.156.40]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id VAA08620 for ; Sun, 21 Sep 1997 21:11:54 -0700 (PDT) Received: (from sef@localhost) by kithrup.com (8.8.5/8.6.6) id VAA01246; Sun, 21 Sep 1997 21:11:53 -0700 (PDT) Date: Sun, 21 Sep 1997 21:11:53 -0700 (PDT) From: Sean Eric Fagan Message-Id: <199709220411.VAA01246@kithrup.com> To: karpen@ocean.campus.luth.se Subject: Re: Bug in malloc/free (was: Memory leak in getservbyXXX?) Cc: hackers@FreeBSD.ORG Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >But if you do that allocation, and by doing so steals the last available >page in the system (swap and memory are exausted after your alloc succeeds) >and you free() it, system gets it back, and something else requests it, when >you don't have anywhere to take memory from for the second malloc(). All the >pages are taken, and you can't swap anything out. Malloc() would have to fail. >No? Hm. Good question :). The intent, as I said, was for the code fragment I gave to work. And yet the committee wanted free() to be able to return memory back to the OS. In that circumstance... the latter is "more important." Since it's, you know, actually written in the standard :). I retract my statement, and offer an apology. Sorry. Sean.