- if (open(FILE, "/proc/${pid}/statm")){
- my $temp = <FILE>;
- @memory = split(/ /,$temp);
+ if (open(FILE, "/proc/${pid}/status")) {
+ while (<FILE>) {
+ my ($key, $val) = split(":", $_, 2);
+ if ($key eq 'VmRSS') {
+ $memory = $val;
+ last;
+ }
+ }
+ close(FILE);