[OT] finding memory hungry bits of my code
Dagfinn Ilmari Mannsåker
ilmari at ilmari.org
Thu Apr 9 14:47:56 BST 2009
Andy Armstrong <andy at hexten.net> writes:
> On 9 Apr 2009, at 14:08, Edmund von der Burg wrote:
>> Do these numbers look reasonable to others? The SHR value seems crazy
>> low, but that might be me reading it all wrong.
>
>
> SHR is AFAIK memory that's been explicitly shared and excludes memory
> that just happens to be shared by COW.
>
> Those figures don't look too scary to me. Some of the RES allocations
> will be COW shared if they were allocated pre-fork.
>
> /me awaits illuminating corrections.
/proc/$pid/smaps is your friend (on recent Linux at least).
# Resident
$ for pid in $(pgrep apache); do sudo awk '$1 ~ /^Rss/ { rss += $2 } END { print rss }' /proc/$pid/smaps; done
88300
93312
95320
95200
95280
93228
# Shared
$ for pid in $(pgrep apache);do sudo awk '$1 ~ /^Shared/ { shared += $2 } END { print shared }' /proc/$pid/smaps; done
67448
65836
66088
65928
65772
65772
--
ilmari
"A disappointingly low fraction of the human race is,
at any given time, on fire." - Stig Sandbeck Mathisen
More information about the london.pm
mailing list