Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How much disk space do shared libraries really save in modern Linux distros?

In the static vs shared libraries debates, I've often heard that shared libraries eliminate duplication and reduces overall disk space. But how much disk space do shared libraries really save in modern Linux distros? How much more space would be needed if all programs were compiled using static libraries? Has anyone crunched the numbers for a typical desktop Linux distro such as Ubuntu? Are there any statistics available?

ADDENDUM:

All answers were informative and are appreciated, but they seemed to shoot down my question rather than attempt to answer it. Kaleb was on the right track, but he chose to crunch the numbers for memory space instead of disk space (my question was for disk space).

Because programs only "pay" for the portions of static libraries that they use, it seems practically impossible to quantitatively know what the disk space difference would be for all static vs all shared.

I feel like trashing my question now that I realize it's practically impossible to answer. But I'll leave it here to preserve the informative answers.

So that SO stops nagging me to choose an answer, I'm going to pick the most popular one (even if it sidesteps the question).

like image 954
Emile Cormier Avatar asked Nov 29 '22 20:11

Emile Cormier


1 Answers

I'm not sure where you heard this, but reduced disk space is mostly a red herring as drive space approaches pennies per gigabyte. The real gain with shared libraries comes with security and bugfix updates for those libraries; applications using static libraries have to be individually rebuilt with the new libraries, whereas all apps using shared libraries can be updated at once by replacing only a few files.

like image 54
Ignacio Vazquez-Abrams Avatar answered Dec 06 '22 07:12

Ignacio Vazquez-Abrams