Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Andreas Schwab <schwab@suse.de>
Cc: gdb-patches@sourceware.org
Subject: Re: Fix memory leaks in libunwind unwinder, part 2
Date: Tue, 12 Jun 2007 14:23:00 -0000	[thread overview]
Message-ID: <20070612142319.GH7815@caradoc.them.org> (raw)
In-Reply-To: <jeir9yh496.fsf@sykes.suse.de>

On Fri, Jun 08, 2007 at 05:09:41PM +0200, Andreas Schwab wrote:
> This is the second part of the memory leak fix for the libunwind
> unwinder.  There is no significant increase in gdb's memory any more.
> 
> Andreas.
> 
> 2007-06-08  Andreas Schwab  <schwab@suse.de>
> 
> 	* frame-unwind.h (frame_dealloc_cache_ftype): Define.
> 	(struct frame_unwind): Add dealloc_cache.
> 	* frame.c (reinit_frame_cache): Call dealloc_cache on all caches.
> 
> 	* libunwind-frame.h (libunwind_frame_dealloc_cache): Declare.
> 	* libunwind-frame.c (libunwind_frame_dealloc_cache): Define.
> 	(libunwind_frame_unwind): Set dealloc_cache.
> 	* ia64-tdep.c (ia64_libunwind_frame_unwind): Set dealloc_cache.

Thanks, this is OK with one fix.
> +  /* Tear down all frame caches.  */
> +  for (fi = current_frame; fi != NULL; fi = fi->prev)
> +    {
> +      if (fi->prologue_cache && fi->unwind->dealloc_cache)
> +	fi->unwind->dealloc_cache (fi, fi->prologue_cache);
> +      if (fi->base_cache && fi->base->unwind->dealloc_cache)
> +	fi->base->unwind->dealloc_cache (fi, fi->base_cache);
> +    }

Compare with:

  /* Sneaky: If the low-level unwind and high-level base code share a
     common unwinder, let them share the prologue cache.  */
  if (fi->base->unwind == fi->unwind)
    return fi->base->this_base (fi->next, &fi->prologue_cache);
  return fi->base->this_base (fi->next, &fi->base_cache);

I think you shouldn't dealloc the base cache if the two unwinders are
the same, right?

-- 
Daniel Jacobowitz
CodeSourcery


  reply	other threads:[~2007-06-12 14:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-08 15:09 Andreas Schwab
2007-06-12 14:23 ` Daniel Jacobowitz [this message]
2007-06-12 14:53   ` Andreas Schwab
2007-06-12 14:59     ` Daniel Jacobowitz

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=20070612142319.GH7815@caradoc.them.org \
    --to=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    --cc=schwab@suse.de \
    /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