From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1014db,cea30133e185dc3 X-Google-Attributes: gid1014db,public X-Google-Thread: fee84,cea30133e185dc3 X-Google-Attributes: gidfee84,public From: Larry Weiss Subject: Re: How do you release memory back to the kernel in C Date: 1998/05/20 Message-ID: #1/1 X-Deja-AN: 355051033 Content-Transfer-Encoding: 7bit References: <35616C36.9167165F@citicorp.com> <35620a04.2342689789@207.126.101.81> X-Orig-Message-ID: <356332A2.468C@airmail.net> Content-Type: text/plain; charset=us-ascii NNTP-Posting-Time: Wed May 20 14:44:31 1998 Organization: ... NNTP-Proxy-Relay: library.airnews.net Mime-Version: 1.0 Abuse-Reports-To: abuse at airmail.net to report improper postings Newsgroups: comp.unix.osf.osf1,comp.lang.c Kaz Kylheku wrote: > On Tue, 19 May 1998 12:25:42 +0100, Asgar Ali wrote: > >In DEC Unix (3.x and 4.x) I am finding that "free" does not release > >memory back to the kernel so that it could be used by other processes. > > See Peter Seebach's Infrequently Asked Questions list: > 6.9: I have a program which mallocs but then frees a lot of memory, > but memory usage (as reported by ps) doesn't seem to go back down. > You're probably not freeing the memory completely. Try replacing > free(foo); > with > > free(foo); > free(foo); > free(foo); > > in case the first free() frees the memory only partially. > (Unix wizards may recognize the parallel with syncing three times > before rebooting.) > Kind of reminds me of the old Tony Orlando and Dawn song...which itself contains advice equally useful to addressing the question at hand as this IAQ answer (as expected). - Larry Weiss