Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!ucbvax!dog.ee.lbl.gov!elf.ee.lbl.gov!torek From: torek@elf.ee.lbl.gov (Chris Torek) Newsgroups: comp.lang.c Subject: Re: Return segment to OS Message-ID: <12375@dog.ee.lbl.gov> Date: 23 Apr 91 00:34:04 GMT References: <1991Apr22.100300.1367@mdcbbs.com> Reply-To: torek@elf.ee.lbl.gov (Chris Torek) Organization: Lawrence Berkeley Laboratory, Berkeley Lines: 20 X-Local-Date: Mon, 22 Apr 91 17:34:04 PDT In article <1991Apr22.100300.1367@mdcbbs.com> gd010gd02@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@ee.lbl.gov