Marcus Clyne wrote:
David Daney wrote:
Marcus Clyne wrote:
Hi David,
Thanks for your quick reply. Other than forking and exec'ing, is
there an easy way of determining this value within a C program?
You could write code (perhaps using something like libelf) to iterate
through all the LOAD Program Headers, and add up their memory sizes.
I'm not sure how to access the LOAD program headers. Are these
accessible like normal symbols using dlsym, or could you direct me to a
webpage where I could read up on it.
http://en.wikipedia.org/wiki/Executable_and_Linkable_Format
Thanks,
Marcus.
Thanks,
Marcus.
David Daney wrote:
Marcus Clyne wrote:
Hi,
Is there any way to determine the actual memory used by a
dynamically loaded (i.e. by dlopen...) shared object. AFAIK this
is less than the size of the .so file on disk, but I'm not sure how
to calculate it.
Can anyone help?
For ELF shared objects, it should be close to the size printed by
the 'size' command. The dynamic linker may have to allocate a small
amount of additional memory as part of the linking process.
David Daney