http://qs1969.pair.com?node_id=115324


in reply to Determining memory usage of a process...

On Linux (since h option differs from BSD),

my $sz = `ps h -o sz $$`;
Other ps stats can be gotten similarly. It uses the rich ps system call for process stats, see 'man ps'. Perl's $$ variable is the current pid.

Another approach is to root around in the "/proc/$$/" or '/proc/self/' directory.