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

> > 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.

ok. unfortunately this was not in my own code,
but in libsec (mostly x509.c).
I submitted a patch to plug the leaks I encountered --
should I also submit a patch for the setmalloctag's
I added to analyse what goes on?

> Or just think really hard.

even with leak(1) and additional setmalloctag calls
I already had to think hard enough to make sure
I did (free) the right thing (at the right place).


Something else about leak:
when I run it in textual mode (no option or -s)
it doesn't report leaks.
when I run it in graphical mode (-b) I do get
red pieces in the picture.
This surprises (confuses) me a bit.


Charles said:
> there was an older acid leak detection library that
> took a snapshot of the call stack on each allocation.
> that was useful, as you say.

(just curious)
any particular reason this was deprecated (assuming it is)?


Axel.


  reply	other threads:[~2005-09-16 11:29 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
2005-09-16 11:29       ` Axel Belinfante [this message]
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=200509161129.j8GBTC302928@zamenhof.cs.utwente.nl \
    --to=axel.belinfante@cs.utwente.nl \
    --cc=9fans@cse.psu.edu \
    --cc=rsc@swtch.com \
    /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).