Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Sep 2020 08:01:41 -0600
From:      Ian Lepore <ian@freebsd.org>
To:        SHAMANTHA KRISHNA K G <shamanthkrishna23@gmail.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Determing Heap and stack size of running process.
Message-ID:  <b7409b8d1c63911620021d549a3bf4879d793d09.camel@freebsd.org>
In-Reply-To: <CACc2HZniUSjcqL1zyWuQFOq1VP4nYXWc0Ewg3HcdAb0Td6P0%2Bg@mail.gmail.com>
References:  <CACc2HZn4uRERg7XatUvEe8vhyEtteP-Fscot50KvX_PEks1rEA@mail.gmail.com> <2db16d9822eab8fb536eaf705d6378487c7994ae.camel@freebsd.org> <CACc2HZniUSjcqL1zyWuQFOq1VP4nYXWc0Ewg3HcdAb0Td6P0%2Bg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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"




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?b7409b8d1c63911620021d549a3bf4879d793d09.camel>