Determining the memory used by a dynamically loaded shared object

Marcus Clyne maccaday@gmail.com
Mon Aug 10 17:56:00 GMT 2009


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?

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
>



More information about the Gcc-help mailing list