RE: OFFTOPIC: short question regarding shared libs

Jeremy Fitzhardinge (jsgf@sirius.com)
Tue, 15 Sep 1998 13:15:09 -0700 (PDT)


On 15-Sep-98 Meino Christian Cramer wrote:
> Hi!
> Short question: Is there any hack/trick/possibility
> to show, what shared libs are currently loaded, and
> how much space of mem they occupy each? What triggers
> the unload of shred libs, if not in use?

Shared libraries are mapped into each process address space with mmap(). They
are never explicitly loaded or unloaded. When a page is first used, the kernel
faults it in from the file. If a page has been unused for some time (even if
its still mapped), it may be dropped from memory. If a file has no mappings,
it will still exist cached in memory until it gets evicted by the normal
process (which may not ever happen if its frequently used).

/proc/<pid>/maps will show you all the shared libraries used by a process,
including the virtual size. Its very hard to tell how much physical memory
each mapping is using however.

Normal executables work a lot like shared libraries, except the mmap() is done
implicitly by execve().

J

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/