Re:Go Memory Management
by de_Selby on Monday August 20, 2018 @08:03AM
(#17799248)
Go programs are statically linked, you're referring to dynamic linking.
[ Parent
| on HN ]
Actually, the libc is dynamically linked here, as shown in the /proc/maps section of the article.
So, to answer the GP: yes, resident memory from the libc ends up being amortized between all the processes that use it. But it doesn't even matter much as there's a mere 5 MiB of resident memory involved here. The “hundreds of MiB” are only of virtual memory, and that shouldn't be of any concern (see my other comment in this thread).
> Go programs are statically linked
Not necessarily true, unless you use strategies like the one suggested in the top level post above this. https://www.osso.nl/blog/golang-statically-linked/
In practice, those dependencies are ubiquitous enough that the "DLL hell" half of the dynamic-linking problem is avoided. The other issues (system-dependent behavior quirks, estimation from static libraries, linker caching, etc. etc.) remain in many cases.