Measuring memory footprint in C/C++ code on FreeBSD
peterjeremy at acm.org
Fri Oct 21 11:05:19 UTC 2011
On 2011-Oct-20 19:57:31 +0200, Razmig K <strontium90 at gmail.com> wrote:
> 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.
It's not clear whether the program is attempting to determine it's
own (or a child's) memory footprint, or that of an arbitrary process.
In the former case, getrusage() is the obvious choice. This as a
If you want to examine arbitrary processes, the best interface on
FreeBSD would be kvm_getprocs(3).
BTW, since you mention heap objects, I presume you are aware that
malloc() uses mmap(), rather than sbrk() to obtain memory.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20111021/1cac42aa/attachment.pgp
More information about the freebsd-hackers