Measuring memory footprint in C/C++ code on FreeBSD

Razmig K strontium90 at
Thu Oct 20 18:23:06 UTC 2011


     I'd like to measure the memory footprint in C/C++ code for a 
program running under FreeBSD and Linux in terms of total process size 
including heap objects. Due to execution length, I'd like to avoid the 
use of valgrind.
     I think that it would be difficult to achieve the task in a 
platform-transparent manner, that's why I'll be using /proc/<pid>/status 
on Linux, and do something else on FreeBSD.
     I was adviced to have a look on getrusage, which I did, but I found 
descriptions of certain fields of struct rusage in the manpage too 
cryptic to make a proper use of the call.
     Could someone please point me in the right direction?
     Thanks very much.


More information about the freebsd-hackers mailing list