[KLUG Programming] Shared libraries & memory usage.
Robert G. Brown
programming@kalamazoolinux.org
Mon, 14 Jul 2003 22:10:27 -0400
On Mon, 14 Jul 2003 21:52:11 -0400, Erik Gillespie <rattles@yakko.cs.wmich.edu> wrote:
>I don't know why the library would need to resolve a symbol if it didn't
>plan on actually using it, in which case yes, it would need to load it.
One very common example is error and bounds checking. If one is loading
a bunch of libs, and there is an address conflict (or a conflict with
something already resident), it may be better to flag this early and
end the process with a diagnostic, rather than loading everything at it's
assigned address and corrupting what's already there.
>Not that they mean the same, but one normally implies the other.
This brings us back to a previous message, which was, in essense.. know your
loader, behavior and available controls vary from environment to environment.
>Then again, I suppose a tool to simply list out a shared library's symbols
>does just that.
Another example, yes.
Connomly, todays machines run processes that are small compared to total
memory available (as a basic assumption). In these cases, it is a good thing
to load the whole lib (or memory map it as Adam has pointed out, and let
demand paging work out what needs to be where, as needed), and resolve the
symbols up front (some loaders reduce the needfor this by puting the symbol
table in the root executable), then us them as needed. Object-at-a-time
loading represents time-resource tradeoffs that we can talk about if anyone
is interested....
Regards,
---> RGB <---