6 ms·
I work on an embedded linux system that has 256 MB of RAM. That can get eaten up really fast if every process has its own copy of everything.
by umvi 7y ago
I work on an embedded linux system that has 256 MB of RAM. That can get eaten up really fast if every process has its own copy of everything.
- freemint 7y agoYou should look into fdpic as format to store your binaries in. It think i might lessen your concerns.
- __d 7y agoNote that when using static linking, you don't get a copy of everything, just everything you actually use. It doesn't alter the fundamental point: shared libraries save both persistent storage and runtime memory.
- saagarjha 7y ago> Note that when using static linking, you don't get a copy of everything, just everything you actually use. Which is a significant fraction of everything even if you call simple like printf. > It doesn't alter the fundamental point: shared libraries save both persistent storage and runtime memory. I fail to see the argument for this. Dynamic linking deduplicates dependencies and allows code to be mapped into multiple processes "for free".
- admax88q 7y agoHave you measured it? How much is dynamic linking saving you? How many processes are you running on embedded systems with of 256MB or RAM?
- saagarjha 7y ago256MB of RAM is a fairly large amount–this is how much iPhone 3GS had, for instance. It relied on dynamic linking to system libraries heavily and ran multiple processes.
- jfkebwjsbx 7y agoThat proves the point: with multi-GiB memory nowadays you can fit many times over all the space that the iPhone saved using dynamic linking.
- saagarjha 7y agoI would rather not be limited on my laptop to iPhone apps from ten years ago.
- __d 7y agoOk, so I just measured with a C "hello world". My dynamically-linked executable is 8296 bytes on disc. My statically-linked executable is 844,704 bytes on disc. So if I had a "goodbye world" program as well, that's a saving of about 800KB on disc. Now one can argue the economics of saving a bit under a megabyte in a time where an 8GB microSD card costs under USD5 in single quantities, but you can't argue that it's a relatively big saving. At runtime, the dynamic version uses (according to top) 10540 KB virtual, 540 KB resident, and 436 KB shared. The static version uses 9092 KB virtual, 256 KB resident, and 188 KB shared. I haven't investigated those numbers.
- __d 7y agoMy second sentence was arguing for dynamic linkage (I called them "shared libraries", but I think that's a fairly common nomenclature).
- userbinator 7y ago~15 years ago my "daily driver" had 256MB of RAM and it was perfectly usable for development (native, none of this new bloated web stuff) as well as lots of multitasking. There was rarely a time when I ran out of RAM or had the CPU at full usage for extended periods. Now it seems even the most trivial of apps needs more than that just to start running, and on a workstation, less than a year old with 4 cores of i7 and 32GB of RAM, I still experience lots of lag and swapping (fast SSD helps, althougn not much) doing simple things like reading an email.
- smabie 7y agoAre you sure? I've been running Linux for a long time with no page file. From 4gb to 32gb (The amount of RAM I have now) and have literally only ran out of RAM once (and that was because of a bug in a ML program I was developing). I find it very hard to believe that you experience any swapping at all with 32gb, much less "lots".
- kjs3 7y agoYou said yourself you managed to find a case where you ran out of memory. Why do you find it "very hard to believe", knowing nothing about his use cases, that his job doesn't involve exactly the sort of situations that consume vast amounts of RAM. Why do people insist with such conviction that "it doesn't happen to me, therefore it's inconceivable that it happens to someone else, doing something totally different than what I'm doing, into which I have no insight". Baffling.
- Wowfunhappy 7y ago> Why do you find it "very hard to believe", knowing nothing about his use cases, that his job doesn't involve exactly the sort of situations that consume vast amounts of RAM. Probably the GGP said they experience lag while "doing simple things like reading an email." Now, maybe GGP meant to add "while I'm sequencing genes in the background", but since that was left out I can see how it would be confusing! :)
- kjs3 7y agoThen don't statically link. "Emebedded systems" requirements shouldn't dictate "Desktop" or "Server" requirements.
- wuschel 7y agoSo dynamic linking makes sure they each dependency is loaded into memory just once? Could someone estimate how much software nowadays is bloated by duplicated modules?