[comp.unix.internals] resource consumption of shared libraries

flee@cs.psu.edu (Felix Lee) (06/22/91)

On a Sun-4 running SunOS 4.1.1, the null C program takes about 10k of
disk space when statically linked (-n -Bstatic).  start calls exit()
which calls _cleanup() which brings in _flsbuf() which drags in
malloc() and friends.

When dynamically linked (-n -Bdynamic), the null program takes a
little over 1k of disk space.

So dynamic vs. static saves at least 8k of disk space per executable.
This savings may disappear if you use zmagic executables.

When running, the static null program requires 5 pages (8k each) of
memory: 2 text, 1 data, 1 bss, and 1 stack.

The dynamic null program requires at least 20 pages: 1 text, 1 data, 1
bss, 1 stack, 5 for ld.so, and 11 from libc.so.1.6.  The number for
libc may be a little low, but presumably all of it is shared with any
number of other programs running on the same machine.

All these numbers are nearly meaningless.  The null executable isn't
really very interesting or useful.  It does show that stdio is quite
fat.  Small programs like /bin/echo would be much larger if stdio
weren't shared.
--
Felix Lee	flee@cs.psu.edu