From: Andreas Schwab <schwab@suse.de>
To: gdb-patches@sourceware.org
Subject: Re: Fix memory leaks in libunwind unwinder, part 2
Date: Tue, 12 Jun 2007 14:53:00 -0000 [thread overview]
Message-ID: <jemyz5b4wb.fsf@sykes.suse.de> (raw)
In-Reply-To: <20070612142319.GH7815@caradoc.them.org> (Daniel Jacobowitz's message of "Tue\, 12 Jun 2007 10\:23\:19 -0400")
Daniel Jacobowitz <drow@false.org> writes:
> 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?
In this case the base cache was never used, so there is nothing to
deallocate.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, MaxfeldstraÃe 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
next prev parent reply other threads:[~2007-06-12 14:53 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
2007-06-12 14:53 ` Andreas Schwab [this message]
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=jemyz5b4wb.fsf@sykes.suse.de \
--to=schwab@suse.de \
--cc=gdb-patches@sourceware.org \
/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