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

Re: execve - what happens to dynamically allocated memory?



On Thu, Nov 01, 2001 at 03:41:12PM +0100, Russell Coker wrote:
> > The dynamically allocated memory is deallocated. Mostly because the
> > allocation of memory via malloc() is done strictly within the C library,
> > and the only time it actually uses system resources is when it calls
> > sbrk() to grab more heap memory when it runs out.
> 
> For libc6 in it's default mode of operation...  Other malloc libraries may do 
> different things.  For example Electric Fence allocates memory with mmap() 
> instead.

Note that libc does use sbrk for small chunks of memory but if you allocate,
say, 100K or more, it will use mmap instead. The actual limit is tunable.
-- 
Martijn van Oosterhout <kleptog@svana.org>
http://svana.org/kleptog/
> Magnetism, electricity and motion are like a three-for-two special offer:
> if you have two of them, the third one comes free.



Reply to: