dannyman at toldme.com
Mon Nov 17 11:45:54 PST 2008
On Sun, Nov 16, 2008 at 2:41 AM, Jeremy Chadwick <koitsu at freebsd.org> wrote:
> On Sun, Nov 16, 2008 at 12:22:11AM -0800, perryh at 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?
"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.
More information about the freebsd-questions