Niko Tyni writes ("Re: linking perl statically against libperl"): > If there are several /usr/bin/perl processes and /usr/bin/perl is > statically linked against libperl, every process has its own copy of > the libperl code in memory. In the case of dynamic linking, there's just > one copy.
I don't think this is true. We use shared text executables, which means that every copy of the same executable loaded into memory is actually handled by sharing the pages between the various processes. zealot:~> cat /proc/self/maps 08048000-08054000 r-xp 00000000 fe:02 549403 /bin/cat 08054000-08055000 r--p 0000b000 fe:02 549403 /bin/cat 08055000-08056000 rw-p 0000c000 fe:02 549403 /bin/cat 09595000-095b6000 rw-p 00000000 00:00 0 [heap] f7406000-f757d000 r--p 00000000 fe:02 82675 /usr/lib/locale/locale-archive f757d000-f757e000 rw-p 00000000 00:00 0 f757e000-f76dd000 r-xp 00000000 fe:02 1171765 /lib/i386-linux-gnu/i686/cmov/libc-2.13.so f76dd000-f76df000 r--p 0015e000 fe:02 1171765 /lib/i386-linux-gnu/i686/cmov/libc-2.13.so f76df000-f76e0000 rw-p 00160000 fe:02 1171765 /lib/i386-linux-gnu/i686/cmov/libc-2.13.so f76e0000-f76e3000 rw-p 00000000 00:00 0 f76fd000-f76ff000 rw-p 00000000 00:00 0 f76ff000-f7700000 r-xp 00000000 00:00 0 [vdso] f7700000-f771c000 r-xp 00000000 fe:02 286779 /lib/i386-linux-gnu/ld-2.13.so f771c000-f771d000 r--p 0001b000 fe:02 286779 /lib/i386-linux-gnu/ld-2.13.so f771d000-f771e000 rw-p 0001c000 fe:02 286779 /lib/i386-linux-gnu/ld-2.13.so ffdf6000-ffe17000 rw-p 00000000 00:00 0 [stack] zealot:~> Notice how the file /bin/cat is directly mapped into the process's address space, mostly read-only. The exception is the read/write data segment, which has to be mapped copy-on-write so that different processes can each write their own stuff to it. But that's no different to the libperl case. Compare: zealot:~> perl -pe '' /proc/self/maps 08048000-081b1000 r-xp 00000000 fe:02 34174 /usr/bin/perl 081b1000-081b2000 r--p 00168000 fe:02 34174 /usr/bin/perl 081b2000-081b4000 rw-p 00169000 fe:02 34174 /usr/bin/perl ... Total r/w size for statically linked perl attributable to perl and libperl: 0x2000. (64)ian@zealot:~$ perl -pe '' /proc/self/maps 00400000-00402000 r-xp 00000000 fe:04 1410782 /usr/bin/perl 00601000-00602000 r--p 00001000 fe:04 1410782 /usr/bin/perl 00602000-00603000 rw-p 00002000 fe:04 1410782 /usr/bin/perl 01f59000-01f9b000 rw-p 00000000 00:00 0 [heap] ... 7fd6745d5000-7fd67474c000 r-xp 00000000 fe:04 1410724 /usr/lib/libperl.so.5.14.2 7fd67474c000-7fd67494c000 ---p 00177000 fe:04 1410724 /usr/lib/libperl.so.5.14.2 7fd67494c000-7fd674950000 r--p 00177000 fe:04 1410724 /usr/lib/libperl.so.5.14.2 7fd674950000-7fd674955000 rw-p 0017b000 fe:04 1410724 /usr/lib/libperl.so.5.14.2 Total r/w size for 64-bit dynamically linked perl attributable to perl and libperl: 0x3000 + 0x5000. (This is actually more, presumably because of increased rounding on amd64.) So I think statically linking /usr/bin/perl will cost (in memory terms) at most the memory one extra copy of libperl. Ian. -- To UNSUBSCRIBE, email to debian-devel-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/21814.45580.667725.695...@chiark.greenend.org.uk