:) whoops
use File::Which qw/ which /; our $GOTPS = which('ps');
I've used the PID reported by the script in another terminal and ran:
groan :) thats too much lines
#!/usr/bin/perl -- use warnings; use strict; use feature qw{ say }; use File::Which qw/ which /; our $GOTPS = which('ps'); say $$; psMem(); my $file = shift; open my $FH, '<', $file or die $!; my $string; { local $/; $string = <$FH> }; say length $string; psMem(); undef $string; psMem(); seek $FH, 0, 0; $string = do { local $/; <$FH> }; say length $string; psMem(); undef $string; psMem(); sub psMem { my( $pid ) = @_; my @lines = qx{$GOTPS -o vsize,rss -p $pid }; chomp @lines; foreach my $line (@lines) { my ( $vsize, $rss) = split /\s+/, $line; return "VM: $vsize RSS: $rss "; } return; }
In reply to Re^9: memory use array vs ref to array
by Anonymous Monk
in thread memory use array vs ref to array
by dkhosla1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |