Return segment to OS

Chris Torek torek at elf.ee.lbl.gov
Tue Apr 23 10:34:04 AEST 1991


In article <1991Apr22.100300.1367 at mdcbbs.com> gd010gd02 at mdcbbs.com writes:
>It appears that the memory requested from the operating system by
>malloc() is never released even after all the entries in the allocated
>segment have been free()'ed.  Does anyone know of a "safe" way of
>returning a segment to the operating system?

Yes, you make a SYS$RELEASE_SEGMENT call.

No, actually, you call sbrk.

No, no, no, the *right* way is to . . .   :-)

The words `operating system' are a bit hint: this question belongs on
an O/S specific newsgroup (preferably one for the O/S in question).

Note that there is usually no reason malloc() cannot be coded to give
space back to the O/S, but it is sometimes tricky to get this right.
-- 
In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 415 486 5427)
Berkeley, CA		Domain:	torek at ee.lbl.gov



More information about the Comp.lang.c mailing list