From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: Date: Thu, 15 Sep 2005 12:06:43 -0400 From: Russ Cox To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> Subject: Re: [9fans] leak In-Reply-To: <200509151601.j8FG12K29865@zamenhof.cs.utwente.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <200509151601.j8FG12K29865@zamenhof.cs.utwente.nl> Topicbox-Message-UUID: 8a0adce2-ead0-11e9-9d60-3106f5b1d025 > Is there an easy way to record (get at) the whole > function call stack at the moment of allocation > (e.g. like purify gives)? > Right now I just see the immediate caller of malloc > which may be a bit too limited (cumbersome to work with) > at times. No, there isn't a way to get at that. Malloc only saves the caller of malloc and realloc. > I've been adding 'setmalloctag(x, getcallerpc(&foo))' > by hand in the source to slowly get to the caller > of the caller of (the caller of ...) of malloc > and could imagine there is a better way... ? That's what I use. If you allocate something and return it to your caller and he has the responsibility to free it, then call setmalloctag() to push that responsibility onto him. Or just think really hard. Russ