Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Answer: Determining memory usage of a process...

( #115324=categorized answer: print w/ replies, xml ) Need Help??

Q&A > programs and processes > Determining memory usage of a process... contributed by Zaxo

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.

Comment on Answer: Determining memory usage of a process...
Download Code
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2014-07-10 04:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (198 votes), past polls