Re: [gtk-list] Re: Unix Memory Management : Clearing up a few misconceptions (was Re: how can I trust glib when it has so manymemleaks?)
- From: "Mike Durian" <durian boogie com>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: Unix Memory Management : Clearing up a few misconceptions (was Re: how can I trust glib when it has so manymemleaks?)
- Date: Fri, 19 Mar 1999 14:18:08 -0700
On 19 Mar 1999 21:48:50 +0100, Guillaume Laurent <glaurent@worldnet.fr> wrote:
>Michael Babcock <mbabcock@la.creatureshop.henson.com> writes:
>
>> Guillaume Laurent wrote:
>
>[...]
>
>> > UNDER UNIX, WHEN YOU FREE() MEMORY, IT IS NOT RELEASED TO THE OS. THE
>> > SIZE OF YOUR PROCESS WON'T EVER SHRINK, IT CAN ONLY INCREASE.
>
>(BTW, shouting was not my intent here, just trying to make my point
>fairly visible. My apologies to all. Note also that I voluntarily made
>a sweeping statement, I'm quite aware that this is not always
>true. However, it is true most of the time).
Just FYI, this is not true under FreeBSD. The standard malloc
package on FreeBSD contains the following code (in free_pages, called
from ifree called from free):
/* Return something to OS ? */
if (!pf->next && /* If we're the last one, */
pf->size > malloc_cache && /* ..and the cache is full, */
pf->end == malloc_brk && /* ..and none behind us, */
malloc_brk == sbrk(0)) { /* ..and it's OK to do... */
And in that conditional, it does in fact call brk() to return memory to
the system.
This malloc package by phk is covered under his BEER-WARE license
and is thus readily adoptable on other platforms if people want this
sort of behavior on other systems.
mike
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]