Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Sep 1997 00:55:06 +0200
From:      Eivind Eklund <eivind@bitbox.follo.net>
To:        Nate Williams <nate@mt.sri.com>
Cc:        Eivind Eklund <perhaps@yes.no>, phk@critter.freebsd.dk, hackers@freebsd.org
Subject:   Re: Bug in malloc/free (was: Memory leak in getservbyXXX?)
Message-ID:  <19970922005506.48602@bitbox.follo.net>
In-Reply-To: <199709212247.QAA28054@rocky.mt.sri.com>; from Nate Williams on Sun, Sep 21, 1997 at 04:47:19PM -0600
References:  <199709182202.PAA10664@hub.freebsd.org> <199709211737.TAA20833@bitbox.follo.net> <199709212247.QAA28054@rocky.mt.sri.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Sep 21, 1997 at 04:47:19PM -0600, Nate Williams wrote:
> Eivind Eklund writes:
> > [Andrew Atrens]
> > > >From what I can tell Poul your free() actually gives the memory back to the
> > > OS ( at least some of the time ).
> > 
> > If this is correct, it breaks ANSI C behaviour.
> 
> Huh?  I didn't realize ANSI mandated OS support.  Can you quote chapter
> and verse that says this?

It doesn't.  However, it has a formulation that IMHO is too
restrictive - that free() 'makes the memory available for further use
by the program' (from memory).  Thus, an implementation of
malloc()/free() that give memory back to the OS is in violation of the
standard.  (Not that I'm certain how a program would detect this - at
least I personally would consider a program that relies on being able
to re-allocate memory that it has freed buggy.)

Eivind.



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