Re: Determining the memory used by a dynamically loaded shared object

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

 



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.

David Daney



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





[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux