Date: Fri, 11 Sep 2020 10:38:15 -0400 From: Shawn Webb <shawn.webb@hardenedbsd.org> To: SHAMANTHA KRISHNA K G <shamanthkrishna23@gmail.com> Cc: Ian Lepore <ian@freebsd.org>, freebsd-hackers@freebsd.org Subject: Re: Determing Heap and stack size of running process. Message-ID: <20200911143815.77d675abityetbme@mutt-hbsd> In-Reply-To: <CACc2HZkdHOxfz6KWYOUSti0VGqvaiXC2Q56i0CgC86CV79ncVA@mail.gmail.com> References: <CACc2HZn4uRERg7XatUvEe8vhyEtteP-Fscot50KvX_PEks1rEA@mail.gmail.com> <2db16d9822eab8fb536eaf705d6378487c7994ae.camel@freebsd.org> <CACc2HZniUSjcqL1zyWuQFOq1VP4nYXWc0Ewg3HcdAb0Td6P0%2Bg@mail.gmail.com> <b7409b8d1c63911620021d549a3bf4879d793d09.camel@freebsd.org> <CACc2HZkdHOxfz6KWYOUSti0VGqvaiXC2Q56i0CgC86CV79ncVA@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--yzybwqftyuawtm5t Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Given that jemalloc uses anonymous pages, it's not really possible to tell which anonymous pages come from jemalloc's calls to mmap. A number of applications, especially those with JITs, also create anonymous memory mappings. One could infer stack usage by the MAP_STACK flag. Pages marked with MAP_GUARD are definitely not pages destined for the heap (I doubt jemalloc makes use of the relatively new MAP_GUARD flag, though I haven't checked.) Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD GPG Key ID: 0xFF2E67A277F8E1FA GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 https://git-01.md.hardenedbsd.org/HardenedBSD/pubkeys/src/branch/master/Sha= wn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc On Fri, Sep 11, 2020 at 07:59:01PM +0530, SHAMANTHA KRISHNA K G wrote: > Any idea about the fields which have no PRT( I mean no protections flag s= et > --- no read no write no execute) and no flags and with mapping type 'df' = ?. >=20 > Thanks , > -Shamantha. >=20 > On Fri, 11 Sep 2020, 19:31 Ian Lepore, <ian@freebsd.org> wrote: >=20 > > On Fri, 2020-09-11 at 19:26 +0530, SHAMANTHA KRISHNA K G wrote: > > > Thank you for the heads up, I had tried the output of procstat > > > -v also > > > ,there also I am not getting any information about heap usage . > > > > > > Thanks > > > -Shamantha > > > > > > > The output does tell you about heap usage, but you have to interpret > > the type and flags to figure out which mappings are heap allocations, > > and the RES count to figure out how many pages of those mappings are > > actually in use (i.e., backed by physical ram). > > > > Iirc, the mappings with type 'df' and no flags set are the heap > > allocations, but I'm not positive of that. Things with the D flag set > > are thread stacks. I remember the manpage wasn't all that helpful in > > figuring that stuff out last time I needed to know. > > > > -- Ian > > > > > > > > > > > > > > > > > > > > > > > On Fri, 11 Sep 2020, 18:59 Ian Lepore, <ian@freebsd.org> wrote: > > > > > > > On Fri, 2020-09-11 at 16:36 +0530, SHAMANTHA KRISHNA K G wrote: > > > > > Hello All, > > > > > I want to know the *size of heap and stack for a running > > > > > process* ,how > > > > > it can be done, if I* don't *see any* [stack ] *or* [heap] > > > > > *in the > > > > > output > > > > > of */proc/pid/map* and also the platform does not allow > > > > > installing > > > > > *third party > > > > > freebsd utilities like valgrind.* > > > > > > > > > > Thank you, > > > > > -Shamantha > > > > > > > > > > > > > Use procstat(1). For example "procstat -v <pid>" will show all the > > > > memory mappings for that process. If you need it from within a > > > > program > > > > you're writing, "man libprocstat" will get you some info on how > > > > procstat(1) does its work. > > > > > > > > -- Ian > > > > > > > > > > > > > > _______________________________________________ > > > freebsd-hackers@freebsd.org mailing list > > > https://lists.freebsd.org/mailman/listinfo/freebsd-hackers > > > To unsubscribe, send any mail to " > > > freebsd-hackers-unsubscribe@freebsd.org" > > > > > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" --yzybwqftyuawtm5t Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAl9bi9QACgkQ/y5nonf4 4fpfDBAAn5lhCa9TcnttMUpuc9lxnCkhTRBDswahI5mooOO390O/zlPntMuhN1Af 1GmB3JBcQse7F/bA0Faya8qnLVOsh2Dag42YGo6KW0FfDB0aT6KIB9hBTXSal2TG heNTGoHIez51c6xU9D9/Yx25/F5XB4rj7kqqPrmiE8GfsGAuS9+xvHE4fLtyfiY1 9ZuJc1+4/qzFw9EaHrHxDsWZLH3pPxPWrkm335XBlt1SbyNE4YJ4m3AWCjplm6+H O8nExtQPk7+k1Octh6pqmz6qk9THNnyx652A6qsLbgBwEEoLIYOt1lo4MgJIJFdk ahCP8O5Q7vAeKyP5Trac7yPUDW8B5cZh1jbs0VBf4SHjIq0NWre7bDdFbnDqIJKl qfXO2Er8MflS4FiltsfuqcbyoLcxtLVls05MN0/wHZNXywkcAIR1Fsd2AqlULT23 Npm7fSDFVHd1UGADzPHTw6BpkDA5Ew4WQGtwb30ObQwMA5t29F3kV3ndGQMGBg9e 0XWJc7OHJzY60H9KGh6umQKZLustqYo4Jc+CbxHXLslhMfICPwg2w76C4TmyHQOV 0qmHPKwVnow3KUws2luHN8Gr1wEa9AwcP2rw1aBMg/z1TwPNnZT3azXJsTsJBhX4 NvupPLhf67bUOwsMH8OFyQYE1K0YJGK9RjXDhoxG7mQ2eHGtwV0= =dCFB -----END PGP SIGNATURE----- --yzybwqftyuawtm5t--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20200911143815.77d675abityetbme>