From owner-freebsd-questions@FreeBSD.ORG Mon Nov 17 19:45:54 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 263631065677 for ; Mon, 17 Nov 2008 19:45:54 +0000 (UTC) (envelope-from dannyman@toldme.com) Received: from yw-out-2324.google.com (yw-out-2324.google.com [74.125.46.29]) by mx1.freebsd.org (Postfix) with ESMTP id D3EAF8FC08 for ; Mon, 17 Nov 2008 19:45:53 +0000 (UTC) (envelope-from dannyman@toldme.com) Received: by yw-out-2324.google.com with SMTP id 9so1078655ywe.13 for ; Mon, 17 Nov 2008 11:45:53 -0800 (PST) Received: by 10.90.120.14 with SMTP id s14mr2940750agc.20.1226951152853; Mon, 17 Nov 2008 11:45:52 -0800 (PST) Received: by 10.90.99.17 with HTTP; Mon, 17 Nov 2008 11:45:52 -0800 (PST) Message-ID: <2a5241e00811171145y65e421e8q1210604d8be169b4@mail.gmail.com> Date: Mon, 17 Nov 2008 11:45:52 -0800 From: "Daniel Howard" To: "Jeremy Chadwick" In-Reply-To: <20081116104103.GA98266@icarus.home.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20081110203643.GH27646@obspm.fr> <4ad871310811101530p7b2baa0fk7f7b5118e314c11d@mail.gmail.com> <4918CE42.3050504@ccstores.com> <20081115061957.GA10998@ourbrains.org> <20081116023239.GA89267@icarus.home.lan> <20081116033624.GA13618@ourbrains.org> <20081116050107.GA91940@icarus.home.lan> <491fd833.zbV+im4fHqUJ5RRJ%perryh@pluto.rain.com> <20081116104103.GA98266@icarus.home.lan> Cc: perryh@pluto.rain.com, freebsd-questions@freebsd.org Subject: Re: root /etc/csh X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2008 19:45:54 -0000 On Sun, Nov 16, 2008 at 2:41 AM, Jeremy Chadwick wrote: > On Sun, Nov 16, 2008 at 12:22:11AM -0800, perryh@pluto.rain.com wrote: [...] >> > A statically-linked version of bash would waste significant amounts >> > of memory, while a dynamically-linked/shared version would ease that >> > pain. The same applies for any static vs. dynamic program. >> >> How so? Wouldn't a single in-memory instance of the bash text >> segment be shared among all bash processes, across all users? > > http://lists.freebsd.org/pipermail/freebsd-stable/2007-August/thread.html#36647 http://lists.freebsd.org/pipermail/freebsd-stable/2007-August/036654.html "In response to the original post: The kernel's ELF linker/loader for executables will share the text and read-only segments for static executables." This is consistent with my understanding. A statically-linked bash will consume more space on disk, and more memory the first time it is loaded, but as with any other executable, the executable portion of the program will be re-used each time another bash is run. But I am not a developer or a kernel engineer, so if there is a way in which a statically-compiled bash ends up consuming more memory on each invocation for some reason, I'd appreciate an explanation as to why. Sincerely, -daniel -- http://dannyman.toldme.com