[OT] finding memory hungry bits of my code
Mark Hughes
mhsparks at gmail.com
Thu Apr 9 14:50:13 BST 2009
On Thu, Apr 9, 2009 at 2:08 PM, Edmund von der Burg
<evdb at ecclestoad.co.uk> wrote:
> 2009/4/9 Andy Armstrong <andy at hexten.net>:
>> That sounds as if it could just be Perl getting up to cruising (memory)
>> altitude. Perl isn't especially keen on giving memory back to the OS once
>> it's used it; instead it keeps it hanging around and uses it to satisfy
>> future allocations.
>
> Perhaps you're right - but our cruising altitude would seem to be very
> high: our biggest processes according to top:
>
> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
> 2050 web 15 0 126m 112m 5624 S 0 1.4 0:21.66
> /usr/sbin/apache-perl
Our mod_perl processes are even larger than that! Though as we are
running multiple versions of the app a lot (thousands) of Class::DBI
classes are created which accounts for most of this.
Is this a 64bit OS? Typically I've noticed that Perl memory usage
doubles in this environment.
> Do these numbers look reasonable to others? The SHR value seems crazy
> low, but that might be me reading it all wrong.
>
> Almost everything gets preloaded in our startup.pl script so it should
> get shared.
>
We had this concern as well. however using smaps via this script
http://www.contrib.andrew.cmu.edu/~bmaurer/memory/smem.pl
indicated that a lot more memory was being shared than top reported.
I'm not sure how reliable Linux memory reporting is:
http://bmaurer.blogspot.com/2006/03/memory-usage-with-smaps.html
Mark.
More information about the london.pm
mailing list