Static linking and memory usage

David Schwartz davids at
Tue Aug 14 15:07:43 PDT 2007

> If I have an executable which is staticly linked with many copies
> of it running (a CGI script in fact), will all those copies share
> the text segment of the executable on the disc, or will it actually
> use up real memory resource with many copies of the executable ? I
> have been assuming the former, but possibly that is not correct.

As is the case for all files, if the contents are not modified, the physical
memory is shared. Two or more processes can map the same page of the same
file and will get the same physical page of memory, normally marked


More information about the freebsd-stable mailing list