[CentOS] large memory usage by perl .so modules?

Fri Apr 8 21:19:37 UTC 2011
E R <pc88mxer at gmail.com>

Under Centos 5.5 on an x86_64 box I am seeing large memory usage
associated with perl .so modules.

Example: this script:

use Time::HiRes;

open(SMAPS, "/proc/$$/smaps");
while (<SMAPS>) {
  if (m/^\d/) {
    chomp($lib = (split(' ', $_))[5]);
  } elsif (m/^Size:\s*(\d+.*)/) {
    my $size = $1;
    print "$size $lib\n" if ($lib =~ m/HiRes/);

produces this output:

24 kB /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/auto/Time/HiRes/HiRes.so
2044 kB /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/auto/Time/HiRes/HiRes.so
4 kB /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/auto/Time/HiRes/HiRes.so

What is this 2044 kB entry? On a 32-bit Centos 5.4 box the same script emits:

20 kB /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/Time/HiRes/HiRes.so
4 kB /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/Time/HiRes/HiRes.so

The 2044 kB entry seems to be counted towards memory usage as reported by ps.