[dtrace-discuss] Getting total memory allocated so far

James Carlson
Wed, 02 Jan 2008 18:25:10 -0000

Lally Singh writes:
> I''d like to track to total amount of memory the
application''s actually
> using right now.   More specifically, I guess these rules would do it:
>
> 1. start at M=0
> 2. for each call to malloc(): set M += size of block returned by malloc
> 3. for each call to free(): set M -= size of block freed.

Using "env LD_PRELOAD=libumem.so myapp" with mdb''s umem
support should
get you that (plus quite a bit more).

--
James Carlson, Solaris Networking              <james.d.carlson at
sun.com>
Sun Microsystems / 35 Network Drive        71.232W   Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757   42.496N   Fax +1 781 442 1677