From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14915 invoked by alias); 4 Sep 2009 22:44:08 -0000 Received: (qmail 14906 invoked by uid 22791); 4 Sep 2009 22:44:07 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 04 Sep 2009 22:43:59 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id B3D9D2BABB8; Fri, 4 Sep 2009 18:43:55 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id jyLra1FUrIrJ; Fri, 4 Sep 2009 18:43:55 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 5D8862BAB89; Fri, 4 Sep 2009 18:43:55 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id E965EF589B; Fri, 4 Sep 2009 15:43:51 -0700 (PDT) Date: Fri, 04 Sep 2009 22:44:00 -0000 From: Joel Brobecker To: Doug Evans Cc: Paul Pluzhnikov , gdb@sourceware.org Subject: Re: TYPE_NAME memory management Message-ID: <20090904224351.GB30697@adacore.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2009-09/txt/msg00095.txt.bz2 > Sometimes it's a string constant, sometimes it's in malloc space, > sometimes it's on objfile's obstack, and now sometimes it can live in > mmap'd space. My understanding was that, if the type belongs to an objfile, then the type name should be allocated on the objfile obstack. I know we have types that do not belong to objfiles (types that are duplicated from objfile types in order to preserve a value from the value history, or gdbarch types; any others?), and these types are allocated on the heap, including the type name, but I don't think we ever deallocate these types. Perhaps we might want to review all TYPE_NAME and TYPE_TAG_NAME assignments. If there is a memory leak due to an incorrect malloc, we might want to fix that too. > [...] except for the new mmap'd values, so it seems like the thing to > do for now is copy such strings onto the objfile's obstack. This sounds right. > I'm not sure what the speed loss will be, but I think it's the thing > to do pending data that says something more clever is needed. Agreed - correctness before speed :) -- Joel