5 ms·
Another major benefit of dynamic linking is that multiple processes can share the same dylib in memory -- for things like Apple's AppKit.framework, that can add
by captainredbeard 8y ago
Another major benefit of dynamic linking is that multiple processes can share the same dylib in memory -- for things like Apple's AppKit.framework, that can add up to significant savings when multiplied across all of the open apps.
https://www.quora.com/What-is-the-difference-between-static-and-dynamic-linking https://www.quora.com/What-is-the-difference-between-static-...
- asveikau 8y agoI believe recent Windows and other recent OSs can hash the contents of pages and de-dupe them, which could have some benefits for the same library linked statically across multiple binaries, assuming the identical code ends up page aligned in the same way. This strategy also has benefits for running VMs with the same OS loaded multiple times. See: https://en.wikipedia.org/wiki/Kernel_same-page_merging https://en.wikipedia.org/wiki/Kernel_same-page_merging
- maccam94 8y agoThat requires all of the apps to be built with the same exact version of the library.
- asveikau 8y agoSo does hashing the DLLs before you load them, negating much of the purpose of dynamic linking. That was my point. Anyway if you really want to get technical, if your sharing method is hashing identical pages, I would bet that you don't actually need the same version of the lib to get nonzero sharing. I would not be surprised if many libs have large ranges of identical pages across point releases. Then it's more a question of: was the same compiler used, did it optimize the same way.
- deleted 8y ago[deleted]
- captainredbeard 8y agoStability across recompiles is poor.
- asveikau 8y agoThen why do binary patches work so well? The additional constraint of page boundaries will kill a lot of this. But I have literally seen before my eyes, in the form of looking at binary diffs, that library changes wind up a lot smaller than we expect. So I do think it is possible.