From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4756 invoked by alias); 16 Apr 2009 22:09:52 -0000 Received: (qmail 4743 invoked by uid 22791); 16 Apr 2009 22:09:50 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 16 Apr 2009 22:09:39 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n3GM9Y93029559 for ; Thu, 16 Apr 2009 18:09:34 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n3GM9XHV021407; Thu, 16 Apr 2009 18:09:33 -0400 Received: from opsy.redhat.com (vpn-12-173.rdu.redhat.com [10.11.12.173]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n3GM9WcG023592; Thu, 16 Apr 2009 18:09:33 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 3B4BB50830B; Thu, 16 Apr 2009 16:09:32 -0600 (MDT) To: Jan Kratochvil Cc: gdb-patches@sourceware.org Subject: Re: [patch] [5/5] Types reference counting [value_history_cleanup] References: <20090411102237.GF32624@host0.dyn.jankratochvil.net> <20090413124354.GA13859@host0.dyn.jankratochvil.net> From: Tom Tromey Reply-To: tromey@redhat.com Date: Thu, 16 Apr 2009 22:09:00 -0000 In-Reply-To: <20090413124354.GA13859@host0.dyn.jankratochvil.net> (Jan Kratochvil's message of "Mon\, 13 Apr 2009 14\:43\:54 +0200") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: 2009-04/txt/msg00396.txt.bz2 >>>>> "Jan" == Jan Kratochvil writes: Jan> There is now a fix to free anything at all. When the function Jan> was written there was an older implementation of type_decref Jan> which was incorrectly freeing the zero-reference-count types Jan> immediately (and not just on the garbage collection by Jan> free_all_types). Jan> gdb/ Jan> 2009-04-13 Jan Kratochvil Jan> * value.c (value_history_cleanup): New function. Jan> (_initialize_values): Setup a value_history_cleanup final call. I don't generally like to add work on the exit path. So, I think your initial comment was on target -- we should have some kind of checking mode that enables this; and then do like GCC and arrange to have it enabled in non-release builds. Jan> +/* Sanity check for memory leaks and proper types reference counting. */ Jan> + Jan> +static void Jan> +value_history_cleanup (void *unused) Jan> +{ This should probably free values_in_python as well. I don't think we have a convenient way to destroy all the types referenced by Type objects, but perhaps we ought to add one for this. Tom