Date: Fri, 21 Oct 2011 19:44:13 +1100 From: Peter Jeremy <peterjeremy@acm.org> To: Razmig K <strontium90@gmail.com> Cc: freebsd-hackers@freebsd.org Subject: Re: Measuring memory footprint in C/C++ code on FreeBSD Message-ID: <20111021084413.GA46039@server.vk2pj.dyndns.org> In-Reply-To: <4EA0610B.90206@gmail.com> References: <4EA0610B.90206@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] On 2011-Oct-20 19:57:31 +0200, Razmig K <strontium90@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 portable interface. 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. -- Peter Jeremy [-- Attachment #2 --] -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAk6hMN0ACgkQ/opHv/APuIeatQCglXjkBVAyxZ1bqGxU9gMHLthX 7noAoL4YBgGFaeg6b4HO8/SSpJI0AnHU =912H -----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111021084413.GA46039>
