Re: shared libraries and memory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


On Sat, 2006-07-01 at 09:27, Mike - EMAIL IGNORED wrote:
> When I use a shared library, is it all in memory,
> or is only the object code currently in use in
> memory?  I ask because I have some object code
> that will be used only rarely.

There is nothing special about shared libraries in
this respect except that other programs might already
had loaded them.  Executable code is paged in on
demand when accessed - if you don't access it (or
something nearby), it doesn't load into RAM.  You
don't have a lot of control over that 'nearby' part
though - if the part you execute is spread out and
needs an assortmet of static data, you may end up
with the whole thing in memory because of the page
granularity.  Shared libraries have some overhead
compared to static linkage too - they are only a real
win if multiple programs load them or if they aren't
linked initially and you sometimes/rarely use dlopen()
to access them.

  Les Mikesell

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux