jimsearle has asked for the wisdom of the Perl Monks concerning the following question:

I have a process using about 11g as reported by ps:
  PID USER        SZ       RSS      COMMAND
 6548 someuser    12339104 12210376 someprocess
But when I use Proc::ProcessTable::Process it returns a big negative number for rss.
bless( { 'cmajflt' => 0, 'cminflt' => 18193, 'cmndline' => '/tools/atoptech/AP_09.02.rel.5.1/Lin +ux/bin/rhel4-64/AP -4 -batch scripts/apPNR/droute_opt.scr -wait -tmp_ +dir APTempDir/droute_opt.tmp -adc_dir APTempDir/droute_opt.adc -cmd_l +og APTempDir/droute_opt.cmd.log -log logs/apPNR/droute_opt.log ', 'cstime' => '120000', 'ctime' => '320000', 'cutime' => '200000', 'cwd' => undef, 'egid' => 20, 'euid' => 9331, 'exec' => undef, 'fgid' => 20, 'flags' => 0, 'fname' => 'AP', 'fuid' => 9331, 'gid' => 20, 'majflt' => 12, 'minflt' => 3062104, 'pctcpu' => '135.55', 'pctmem' => '344.00', 'pgrp' => 4725, 'pid' => 6548, 'ppid' => 6541, 'priority' => 0, 'rss' => -381493248, 'sess' => 3879, 'sgid' => 20, 'size' => 4102443008, 'start' => '1260511632', 'state' => 'run', 'stime' => '547210000', 'suid' => 9331, 'time' => '53885980000', 'ttydev' => '', 'ttynum' => 0, 'uid' => 9331, 'utime' => '53338770000', 'wchan' => -1 }, 'Proc::ProcessTable::Process' ),
Is this a bug, or some kind of overflow? I'm going to look at the Process code and try to figure it out, but thought I'd ask here as well. Thanks, Jim

Replies are listed 'Best First'.
Re: Proc::ProcessTable::Process returning negative rss?
by dwm042 (Priest) on Dec 11, 2009 at 20:47 UTC
    Offhand, and without looking at the code, I'd suspect a twos complement overflow.

    David.
      David, Thanks. After further investigation in the XS extension, I see this in
      func bless_into_proc ... case 'l': /* long */ l_val = va_arg(args, long); hv_store(myhash, key, strlen(key), newSVnv(l_val), 0);
      Which stores the rss (long) as numeric (float) with implicit casting, so it is still a bit of mystery why negative value shows up?
      - Jim