This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Global data loaded if symbols aren't resolved
- From: Marcus Clyne <maccaday at gmail dot com>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Mon, 17 Aug 2009 19:53:37 +0300
- Subject: Re: Global data loaded if symbols aren't resolved
- References: <4A86258C.7040309@gmail.com> <m34os6if21.fsf@google.com>
Ian Lance Taylor wrote:
Marcus Clyne <maccaday@gmail.com> writes:
If a shared object is loaded using dlopen etc and the symbols in its
object aren't used (specifically they are defined elsewhere already
inside that process), is the data in the symbols automatically loaded
into memory or is it skipped (assuming there are no other programs
using those symbols on the system) and the memory available for other
purposes?
If you open a shared library with dlopen, then that library is loaded
into memory. This will use up virtual address space. If you don't use
the library for anything, then the pages will never be loaded into RAM.
When the object loaded initially with dlopen(), is there anything that's
transferred to RAM (e.g. the page where the symbol names are), or are
they only copied to the swap space directly? If that's the case, are
they then loaded into RAM when dlsym() is called?
Thanks,
Marcus.