Re: [gtk-list] Re: Unix Memory Management : Clearing up a few misconceptions (was Re: how can I trust glib when it has so manymemleaks?)



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).

> I just did some tests to confirm that I'm not going insane, and yes
> free() DOES return the memory. I tested X (open and close netscape),
> emacs (load and kill a large buffer) and a trivial program of my own
> that just calls malloc(), then free() a bit later. Even if X and Emacs
> was doing something weird, my test program wasn't.

> According to "ps axm" the SIZE of the process does shrink. Dramatically.
> Is ps not a valid way to determine the memory allocated to a process?

It is, but while I'm not surprised about X and Emacs (which have
"advanced" mem management schemes), I'd like to see your test program,
because I could not reproduce this. What amount of memory are you
allocating ?

> So maybe this isn't guaranteed by any standard, but its not like I have
> some oddball system here: Debian 2.1 (glibc 2.0).

I use glibc 2.0 too.

-- 
					Guillaume.
					http://www.worldnet.fr/~glaurent



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]