Re: [gtk-list] free() to OS (was: Re: Unix Memory Management : Clearing up a few misconceptions)



On Fri, 19 Mar 1999, Andreas Bombe wrote:

> This is a bit complicated.  It depends on whether the Unix variant
> inquestion supports shrinking a process' memory space and whether the
> libc in use (which implements malloc() and free() after all) also
> supports this.
[...]
> As you see, this only works in special cases.  Advanced programs that
> do big allocations can avoid using the heap and instead use mmap() to
> allocate memory areas, and these can be freed at run-time, but this
> requires some work from the programmer.  There is the mmalloc package
> which helps with that.

I wish people would stop speaking in generalities here: so far, they've
all (individually) been wrong in one way or another. Modern libc (I'm not
positive whether I just mean glibc, or also Linux libc 5) includes this
ability to mmap() big allocations automatically, and does not require any
assistance from the programmer to accomplish this. I strongly suspect that
this was the cause of the original stated affect.

Libc's malloc() can and will do anything it pleases, and the facilities
commonly available to it include sbrk() and mmap(). For more specific
information, you'll have to mention a specific platform.

-- 
Kenneth Albanowski (kjahds@kjahds.com, CIS: 70705,126)




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