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

看板FB_hackers作者時間14年前 (2011/10/21 19:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串7/11 (看更多)
--3MwIy2ne0vdjdPXF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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=20 >program running under FreeBSD and Linux in terms of total process size=20 >including heap objects. Due to execution length, I'd like to avoid the=20 >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. --=20 Peter Jeremy --3MwIy2ne0vdjdPXF Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAk6hMN0ACgkQ/opHv/APuIeatQCglXjkBVAyxZ1bqGxU9gMHLthX 7noAoL4YBgGFaeg6b4HO8/SSpJI0AnHU =912H -----END PGP SIGNATURE----- --3MwIy2ne0vdjdPXF--
文章代碼(AID): #1EeLWp2H (FB_hackers)
討論串 (同標題文章)
完整討論串 (本文為第 7 之 11 篇):
文章代碼(AID): #1EeLWp2H (FB_hackers)