9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Russ Cox <rsc@swtch.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu>
Subject: Re: [9fans] leak
Date: Thu, 15 Sep 2005 12:06:43 -0400	[thread overview]
Message-ID: <ee9e417a05091509065d24dd71@mail.gmail.com> (raw)
In-Reply-To: <200509151601.j8FG12K29865@zamenhof.cs.utwente.nl>

> 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


  reply	other threads:[~2005-09-15 16:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-24 18:23 Steve Simon
2005-08-24 18:46 ` Sape Mullender
2005-09-15 16:01   ` Axel Belinfante
2005-09-15 16:06     ` Russ Cox [this message]
2005-09-16 11:29       ` Axel Belinfante
2005-09-16 14:16         ` Russ Cox
2005-09-15 16:11     ` Charles Forsyth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ee9e417a05091509065d24dd71@mail.gmail.com \
    --to=rsc@swtch.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).