Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Sep 1997 21:11:53 -0700 (PDT)
From:      Sean Eric Fagan <sef@Kithrup.COM>
To:        karpen@ocean.campus.luth.se
Cc:        hackers@FreeBSD.ORG
Subject:   Re: Bug in malloc/free (was: Memory leak in getservbyXXX?)
Message-ID:  <199709220411.VAA01246@kithrup.com>

next in thread | raw e-mail | index | archive | help
>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.



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