Re: Memory use: returning freed memory to the pool

Tim Timmerman (
Wed, 29 Jan 1997 14:03:55 +0100

>>>>> "Wolfram" == Wolfram Gloger <> writes:

Wolfram> Theodore Ts'o:
>> It depends on the malloc/free implementation. In fact the malloc()
>> which is in the Linux libc will return virtual memory to the OS.

>> HOWEVER, malloc() can only return memory if if there is a contiguous
>> chunk of memory just below brk that it can give back to the system.
>> With X, sometimes this just doesn't happen.
Umm.. but that is not what I observed: I allocated a single block
of ~ 10 M and freed it as a single block: this did not have any
influence on the size of the process.

>> At one point there was someone who was experimenting with a version of
>> malloc() which used mmap in a clever way to try to make it more easy to
>> release memory back to the system.

Wolfram> This isn't experimental any more. It has been in Linux libc for more
Wolfram> than a year now, and seems to work very well.
Could be I have an old version of libc, or I may be using the wrong
alloc : which version fixed this. ?

Anyway, everybody: Thanks for your help: I think I'm starting to
see a way toward some paid overtime...

---------------------------------------------------------------------------- Tel: (Int+031)-(0)40-2580613 Voodoo Programmer/Keeper of the Rubber Chicken
Hemp is a weed, Newt Gingrich is a dope