alloca, malloc and friends
Kaleb Keithley
kaleb at thyme.jpl.nasa.gov
Fri Oct 26 01:24:14 AEST 1990
In article <6793 at suns302.cel.co.uk> ir at cel.co.uk (ian reid) writes:
>
>The problem is that there is no way that this memory can be returned to the
>operating system, at least no way documented on the sbrk(2) manual page which is
>where I would expect to find it, after all free(3) is documented on the malloc
>page. free simply returns the memory to the pool managed by malloc not to the
>operating system, the documented behaviour.
sbrk may be passed a negative number, effectively shrinking the data segment
size, although no implementation of malloc/free that I know of will do this.
You could always roll your own malloc/free that does return free'd memory
to the system this way. Good starting points are any of the malloc/free
sources in gnu emacs, perl, or gwm. All three of these are based on the
4.3 bsd malloc/free, massaged by Caltech, and then polished by Stallman,
Wall, and Nahaboo respectively.
--
Kaleb Keithley Jet Propulsion Labs
kaleb at thyme.jpl.nasa.gov
causing trouble again.
More information about the Comp.unix.questions
mailing list