in reply to Profiling memory

I realise that this isn't what you're asking, but it seemed a relevant place to post this link.

With mod_perl, it is very useful to know how much memory in each child process is shared with the other processes. Having this knowledge makes it easier to calculate the maximum number of processes you can run without starting to swap. On linux, it is also difficult to assess, because top doesn't take Perl's copy-on-write into account.

This script (smem.pl) uses Linux::Smaps (linux >= 2.6.14) to report what memory in use by a process is shared or private, and clean or dirty. The author has posted a blog entry about using smem.pl.

Apologies for hijacking your question, but I thought it worth posting this script to PM.

Clint

Replies are listed 'Best First'.
Re^2: Profiling memory
by jbert (Priest) on Aug 15, 2007 at 08:25 UTC
    Smaps is better than not taking shared memory into account but it only differentiates between 'shared' and 'not shared'. If you're only looking at a collection of mostly-identical processes (e.g. all your mod_perls) then this is probably good enough.

    exmap does per-page reckoning of how many processes have that page mapped, then maps that to ELF section and symbols for you.

    Exmap is a more complex to use and lacks a programmatic interface, but if you have a more heterogenous selection of processes to analyse I'd probably use that. (Actually, I'd probably use it anyway, since I wrote it...)