Hacker News new | past | comments | ask | show | jobs | submit login

That's the party line. It's often wrong. If two copies of the same program are running, they share memory for code. For a shared library to reduce memory consumption, there must be multiple different programs using the same version of the same library. That's not all that common, beyond very basic libraries such as "libc".

Linking to a shared library brings in and initializes the whole library, even if you only need one function from it. So you tend to get stuff paged in during load that never gets used.




That's not all that common

Isn't it? Usually distros target their packages to a single library version, and often people run suites (Gnome, KDE, etc) that use a similar set of libraries in their different processes.


Indeed. ldd any substantial GTK app and scroll past the dependencies. They are huge. Most of them are shared across applications.

Desktop would be crippled if every app was compiled with the whole stack of X, toolkit and Gnome libraries linked in statically.


I'd argue that libraries like GTK were only allowed to become so bloated because dynamic linking masked their true impact on the system. If static linking were the norm, we'd be using much simpler, cleaner libraries because people would think twice about adding 100+ megabytes to their binaries for basic GUIs.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: