From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28747 invoked by alias); 18 May 2009 22:15:44 -0000 Received: (qmail 28739 invoked by uid 22791); 18 May 2009 22:15:43 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.33.17) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 18 May 2009 22:15:34 +0000 Received: from spaceape10.eur.corp.google.com (spaceape10.eur.corp.google.com [172.28.16.144]) by smtp-out.google.com with ESMTP id n4IMFUFR018269 for ; Mon, 18 May 2009 23:15:30 +0100 Received: from qyk9 (qyk9.prod.google.com [10.241.83.137]) by spaceape10.eur.corp.google.com with ESMTP id n4IMFSr1012931 for ; Mon, 18 May 2009 15:15:29 -0700 Received: by qyk9 with SMTP id 9so5850989qyk.4 for ; Mon, 18 May 2009 15:15:28 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.84.196 with SMTP id k4mr3092522qcl.86.1242684928662; Mon, 18 May 2009 15:15:28 -0700 (PDT) In-Reply-To: References: <20090501221639.4FF8A19C4E1@localhost> Date: Mon, 18 May 2009 22:15:00 -0000 Message-ID: <8ac60eac0905181515y13a9bfd8pa7d31f6a02dfae3@mail.gmail.com> Subject: Re: [patch] Eliminate quadratic slow-down on number of soilibs (part 2). From: Paul Pluzhnikov To: tromey@redhat.com Cc: gdb-patches@sourceware.org Content-Type: multipart/mixed; boundary=001636427491bd9bf8046a372122 X-System-Of-Record: true 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: 2009-05/txt/msg00375.txt.bz2 --001636427491bd9bf8046a372122 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-length: 932 On Mon, May 18, 2009 at 2:27 PM, Tom Tromey wrote: > Paul> + { > Paul> + =A0 objc_csym =3D xmalloc (sizeof (*objc_csym)); > Paul> + =A0 *objc_csym =3D objfile_csym; > Paul> + =A0 set_objfile_data (objfile, objc_objfile_data, objc_csym); > Paul> + } > > [...] > > Paul> +void > Paul> +_initialize_objc_lang (void) > Paul> +{ > Paul> + =A0objc_objfile_data =3D register_objfile_data (); > Paul> +} > > I think this should probably call register_objfile_data_with_cleanup, > so that the per-objfile data can be freed when the objfile is > destroyed. I believe you are correct; I misread the objfile_free_data() code. But isn't a better fix to just obstack_alloc the data instead of xmalloc()ing it? Proposed patch attached. Tested on Linux/x86_64, no regressions. Thanks, --=20 Paul Pluzhnikov 2009-05-18 Paul Pluzhnikov * objc-lang.c (find_methods): Plug a small memory leak. --001636427491bd9bf8046a372122 Content-Type: text/plain; charset=US-ASCII; name="objc-memleak.txt" Content-Disposition: attachment; filename="objc-memleak.txt" Content-Transfer-Encoding: base64 X-Attachment-Id: f_fuvq1uoq0 Content-length: 700 SW5kZXg6IHNyYy9nZGIvb2JqYy1sYW5nLmMKPT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PQotLS0gc3JjLm9yaWcvZ2RiL29iamMtbGFuZy5jCTIwMDktMDUtMTgg MTU6MDE6MjUuMDAwMDAwMDAwIC0wNzAwCisrKyBzcmMvZ2RiL29iamMtbGFu Zy5jCTIwMDktMDUtMTggMTQ6NTM6NTguMDAwMDAwMDAwIC0wNzAwCkBAIC0x MjU5LDcgKzEyNTksOCBAQAogCX0KICAgICAgIGlmIChvYmpjX2NzeW0gPT0g TlVMTCkKIAl7Ci0JICBvYmpjX2NzeW0gPSB4bWFsbG9jIChzaXplb2YgKCpv YmpjX2NzeW0pKTsKKwkgIG9iamNfY3N5bSA9IG9ic3RhY2tfYWxsb2MgKCZv YmpmaWxlLT5vYmpmaWxlX29ic3RhY2ssCisJCQkJICAgICBzaXplb2YgKCpv YmpjX2NzeW0pKTsKIAkgICpvYmpjX2NzeW0gPSBvYmpmaWxlX2NzeW07CiAJ ICBzZXRfb2JqZmlsZV9kYXRhIChvYmpmaWxlLCBvYmpjX29iamZpbGVfZGF0 YSwgb2JqY19jc3ltKTsKIAl9Cg== --001636427491bd9bf8046a372122--