From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <619e37293fcc0c4b393fce088c3ed209@plan9.bell-labs.com> To: 9fans@cse.psu.edu Subject: Re: [9fans] output of ps(1) memory usage From: "Russ Cox" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Date: Thu, 20 Feb 2003 20:10:46 -0500 Topicbox-Message-UUID: 6bb42aaa-eacb-11e9-9e20-41e7f4b1d025 > Is the output of ps(1) on the amount of used memory will not > shrink natural? I think you're asking whether the amount of memory used by a process ever shrinks. The answer to that is no. > If so, what is the reason? Almost all programs allocate memory by increasing the size of the data segment (see brk(2)). It's possible to reduce the size, but first you have to get all the good data out of the area you're about to give back. The standard malloc/free interface does not attempt to give anything back. It probably should, but it's not much of an issue for us -- once we clear out our memory leaks programs tend to reach a steady size and then not grow further. > I'm seeing this for threaded programs such as ame and marsv. Leak(1) will check a running program for memory leaks, in case you are concerned about that. Russ