From owner-freebsd-questions Mon Jan 22 0: 2: 7 2001 Delivered-To: freebsd-questions@freebsd.org Received: from guru.mired.org (okc-65-26-235-186.mmcable.com [65.26.235.186]) by hub.freebsd.org (Postfix) with SMTP id B90B737B402 for ; Mon, 22 Jan 2001 00:01:48 -0800 (PST) Received: (qmail 97015 invoked by uid 100); 22 Jan 2001 08:01:34 -0000 From: Mike Meyer MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <14955.59614.539827.693286@guru.mired.org> Date: Mon, 22 Jan 2001 02:01:34 -0600 (CST) To: Cliff Sarginson Cc: Mike Meyer , Gustavo Vieira Goncalves Coelho Rios , questions@FreeBSD.ORG Subject: Re: small program eats lot of memory In-Reply-To: <01012121054701.03293@buffy> References: <14955.1209.195848.394006@guru.mired.org> <01012121054701.03293@buffy> X-Mailer: VM 6.75 under 21.1 (patch 10) "Capitol Reef" XEmacs Lucid X-face: "5Mnwy%?j>IIV\)A=):rjWL~NB2aH[}Yq8Z=u~vJ`"(,&SiLvbbz2W`;h9L,Yg`+vb1>RG% *h+%X^n0EZd>TM8_IB;a8F?(Fb"lw'IgCoyM.[Lg#r\ Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Cliff Sarginson types: > On Sunday 21 January 2001 16:48, Mike Meyer wrote: > > Gustavo Vieira Goncalves Coelho Rios types: > > > I compiled and executed a small program and it's eating about 336 > > > of real memory (rss) and 840 of virtual size memory (vsz), may some > > > one explain why a simple program eats about 1 MB of memory? > > You linked it shared, right? That 1MB includes all of every shared > > library it uses, whether it uses those functions or not. > Pardon ! It certainly does not ! That is the point of shared libraries - > the code is *shared* between processes using it. The required code is > then made dynamically available. Shared libraries are mapped into the memory space of the process. As such, they are part of the memory of the process, and should be counted when adding up the memory of the process, so it'll be the rss (if it's resident) and vsz of the process. Whether or not the physical memory is shared is another question, and I'll let you all continue to debate that. I will say that, given the price of disks, if the memory isn't shared, a system with static binaries might be a better choice than one with dynamic binaries. http://www.mired.org/home/mwm/ Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message