From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10885 invoked by alias); 12 Jun 2007 14:23:14 -0000 Received: (qmail 10875 invoked by uid 22791); 12 Jun 2007 14:23:13 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 12 Jun 2007 14:23:08 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 3FE4F982DE; Tue, 12 Jun 2007 14:23:06 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id E69A8982DC; Tue, 12 Jun 2007 14:23:05 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.67) (envelope-from ) id 1Hy7HD-0004Aa-LX; Tue, 12 Jun 2007 10:23:19 -0400 Date: Tue, 12 Jun 2007 14:23:00 -0000 From: Daniel Jacobowitz To: Andreas Schwab Cc: gdb-patches@sourceware.org Subject: Re: Fix memory leaks in libunwind unwinder, part 2 Message-ID: <20070612142319.GH7815@caradoc.them.org> Mail-Followup-To: Andreas Schwab , gdb-patches@sourceware.org References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.15 (2007-04-09) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-06/txt/msg00165.txt.bz2 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 > > * 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