79487855

Date: 2025-03-05 22:52:59
Score: 1
Natty:
Report link

So this thread got me curious. I linked my program, a full compiler and therefore a non-trivial program, with and without -static. I got:

dynamic: 5,552,800 bytes. static: 6,428,536 bytes.

Doing this with hello world got:

dynamic: 15,960 bytes static: 785,360 bytes

So yes, similar to the OP above in terms of difference. The "big honkin'" program was 865736, but obviously is far less different in relative terms than the simple hello world. In both cases, it seems to be the libc implementation that is most of it. Even in the large program, libc is the biggest import.

Now, what is the net impact of this? In modern demand paged environments, the OS will not load pages that are not executed, so the main memory cost of statically linked sections is not that great. The net cost, then, is disk space, of which at say a current disk drive of 2tb, $70 (Amazon) is:

$70/2,000,000,000,000*865,736 = 0.00003 or 0.3 thousanths of a cent, or approximately the going rate of ant spit.

Something to think about.

Reasons:
  • Long answer (-1):
  • No code block (0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: Scott Franco