Subject: | Proc::ProcessTable issues negative vsize memory value on 64bit Linux |
On a 64-bit Linux, if the program's size grows to certain size, Proc::ProcessTable will return negative:
$ cat /proc/26760/stat
26760 (xxxx) S 2871 2871 2871 0 -1 4202560 265777425 0 140 0 2860043 223065 0 0 20 5 11 0 3512285827 2167234560 488283 18446744073709551615 134512640 136183076 4290675888 18446744073709551615 4294960144 0 674339 4096 682531 18446744073709551615 0 0 17 1 0 0 554
The script:
use Proc::ProcessTable;
my $proc = Proc::ProcessTable->new();
my ($p, $f);
foreach $p (@{$proc->table}) {
next unless $p->uid == $<;
print "--------------------------------\n";
foreach $f ($proc->fields){
print $f, ": ", $p->{$f}, "\n";
}
}
will output:
--------------------------------
uid: 100
gid: 103
pid: 26760
fname: xxxx
ppid: 2871
pgrp: 2871
sess: 2871
ttynum: 0
flags: 4202560
minflt: 265767740
cminflt: 0
majflt: 140
cmajflt: 0
utime: 28599200000
stime: 2230580000
cutime: 0
cstime: 0
priority: 20
start: 1380618862
size: -2127732736
rss: 2000007168
wchan: -1
time: 30829780000
ctime: 0
state: sleep
euid: 100
suid: 100
fuid: 100
egid: 103
sgid: 103
fgid: 103
pctcpu: 93.55
pctmem: 23.88
Note that vsize is 2167234560 (812D6000 hex), while -2127732736 is FFFFFFFF812D6000 in hex.