title: How to measure memory usage from inside a C++ program?
body: <p>Is it possible, for a c++ program, to track how much memory the program is using at one time?</p>
  
  <p>For example, a function with a prototype:</p>
  
  <pre><code>int getEstimatedTotalMemoryUsage();
  </code></pre>
  
  <p>I suppose if it's not possible, then one will have to get out of the program, do a system call and check the results from there. If so, what tools are available for such purposes? Assuming such a thing is possible, that is.</p>
  
  <p>edit: I'm using linux, any tools that can do this for you?</p>