Unix Programming - get virtual memory size of process?

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > November 2005 > get virtual memory size of process?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author get virtual memory size of process?
Markus Dehmann

2005-11-24, 5:54 pm

I have a C++ application that needs to know how much virtual memory it
is using. If it comes close to a certain max (e.g. 2GB) then it needs
to run its own garbage collection routines (to prevent it from crashing).

What's the best way to find out the current virtual memory usage? Is it
reasonable to read the /proc/<pid>/stat file and take the 23rd column
which reports the virtual memory size?

Or is there a better/faster way to find the information? Maybe a C++
function call (linux)?

Thanks!
Markus
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com