From owner-freebsd-questions Mon Jan 22 1: 9:28 2001 Delivered-To: freebsd-questions@freebsd.org Received: from post.mail.nl.demon.net (post-11.mail.nl.demon.net [194.159.73.21]) by hub.freebsd.org (Postfix) with ESMTP id C2D8937B400 for ; Mon, 22 Jan 2001 01:09:06 -0800 (PST) Received: from [195.11.243.26] (helo=Debug) by post.mail.nl.demon.net with smtp (Exim 3.14 #4) id 14KcyG-000IZe-00; Mon, 22 Jan 2001 09:09:04 +0000 To: Mike Meyer , Cliff Sarginson , Mike Meyer , Gustavo Vieira Goncalves Coelho Rios , questions@FreeBSD.ORG From: Cliff Sarginson Subject: Re: small program eats lot of memory Date: Mon, 22 Jan 2001 09:09:04 GMT X-Mailer: www.webmail.nl.demon.net X-Sender: postmaster@btvs.demon.nl X-Originating-IP: 192.250.24.58 Message-Id: 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. So what does the word shared in shared memory mean then :) Hard to see what the point is if all processes load their own copy of shared memory libraries at run time.. I think you will find that physically speaking there is only one libc... in memory under the shared model. Cliff > -- > Mike Meyer 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