[fpc-pascal] Will the size of an executable depend on the uses clause

Florian Klämpfl florian at freepascal.org
Sun Jun 20 11:36:18 CEST 2021



> Am 16.06.2021 um 18:07 schrieb Dennis Lee Bieber via fpc-pascal <fpc-pascal at lists.freepascal.org>:
> 
> On Wed, 16 Jun 2021 13:15:10 +0200 (CEST), Michael Van Canneyt via
> fpc-pascal <fpc-pascal at lists.freepascal.org>
> declaimed the following:
> 
>> ~$ ldd /usr/bin/ls
>> 	linux-vdso.so.1 (0x00007ffc3f9c1000)
>> 	libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007f45b7132000)
>> 	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f45b6f40000)
>> 	libpcre2-8.so.0 => /lib/x86_64-linux-gnu/libpcre2-8.so.0 (0x00007f45b6eb0000)
>> 	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f45b6eaa000)
>> 	/lib64/ld-linux-x86-64.so.2 (0x00007f45b718f000)
>> 	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f45b6e87000)
>> ~$ ls -lh /lib/x86_64-linux-gnu/libselinux.so.1 /lib/x86_64-linux-gnu/libc-2.31.so /lib/x86_64-linux-gnu/libpcre2-8.so.0.9.0 /lib/x86_64-linux-gnu/libdl-2.31.so  /lib/x86_64-linux-gnu/libpthread-2.31.so 
>> -rwxr-xr-x 1 root root 2.0M Dec 16 11:04 /lib/x86_64-linux-gnu/libc-2.31.so
>> -rw-r--r-- 1 root root  19K Dec 16 11:04 /lib/x86_64-linux-gnu/libdl-2.31.so
>> -rw-r--r-- 1 root root 571K Dec  7  2019 /lib/x86_64-linux-gnu/libpcre2-8.so.0.9.0
>> -rwxr-xr-x 1 root root 154K Dec 16 11:04 /lib/x86_64-linux-gnu/libpthread-2.31.so
>> -rw-r--r-- 1 root root 160K Feb 26  2020 /lib/x86_64-linux-gnu/libselinux.so.1
>> 
>> Total size of code needed to run the application: close to 3 Mb.
>> 
>> Comparison is different because of all kinds of memory sharing techniques,
>> but in general, the code size of an FPC binary is not too bad.
>> 
> 
> 	Being Shared Object files, there should be, at most, only one copy of
> the library mapped into memory, and every executable referencing the shared
> object will get mapped into the same memory space.

This still results in pulling in all static data etc. of the libraries. https://dl.acm.org/doi/10.1145/3136014.3136031 <https://dl.acm.org/doi/10.1145/3136014.3136031>
shows that the FPC approach is memory wise more efficient.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20210620/57eafc44/attachment.htm>


More information about the fpc-pascal mailing list