[ILUG] determining how much memory is shared between multiple processes?

Justin Mason jm at jmason.org
Sun Oct 3 21:39:21 IST 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Hi LUG --

I've run into a recurrent question, and hope there's an answer this time
around. ;)

Basically, I have a daemon process which forks N subprocesses, and I'm
trying to determine how much of the subprocesses' pages are being shared
with the parent, through copy-on-write.

top(1) seems to indicate that it can do that:

  t: SHR  --  Shared Mem size (kb)
    The amount of shared memory used by a task.  It simply reflects
    memory that could be potentially shared with other processes.

but some investigation seems to indicate that on my 2.6.6 system, that
*only* applies to code pages loaded from shared libraries; pages allocated
on the heap are never listed in this field, even if they are unmodified
and therefore, presumably, shared.

(This may be a perl thing, though.  the issue is SpamAssassin-related.)

If you take a look at
http://bugzilla.spamassassin.org/show_bug.cgi?id=3839 , you can see our
investigation so far, copies of /proc/*/maps, etc.

Anyone got any good tips for ways to figure this out?

- --j.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Exmh CVS

iD8DBQFBYGN5QTcbUG5Y7woRAh5vAJ49B56XmpnysGvZBMsxKvJ8vf+n7wCg5tP1
VnNBRLuUsaIKtCqfbuLMSzw=
=lPEy
-----END PGP SIGNATURE-----




More information about the ILUG mailing list