Static linking and memory usage

Bruce M. Simpson bms at
Tue Aug 14 11:38:51 PDT 2007

Jeremy Chadwick wrote:
> This reminds me: it sure would be useful if we had something like
> Solaris's pmap(1) on FreeBSD.
In response to the original post: The kernel's ELF linker/loader for 
executables will share the text and read-only segments for static 

We already have something similar to pmap in the ports collection, 
called pmap. However, there is a very detailed and powerful tool for 
Linux called Exmap, by John Berthels.

I used it to profile XORP's shared library memory usage in great detail, 
i.e. it gave me figures on how much memory was saved by the text page 
sharing introduced by the use of shared libraries across related 
executables, enabling me to answer the question, "Is the additional work 
of shared libraries worth the hassle?"

I don't have free time to port Exmap to FreeBSD, but if someone does, I 
can put them in touch with John and forward his fairly detailed 
explanation of how to go about doing that. pmap would be a starting 
point for such a port.


More information about the freebsd-stable mailing list