From patchwork Wed Nov 19 10:46:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 412330 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id AF42B14012B for ; Wed, 19 Nov 2014 21:40:47 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references; q=dns; s= default; b=eIaNX5J2l5/tAKFtXZ+Rx/O/NIsKvRGQqWqClJ4gbgHLtfzdmdC4y AydYD93SJChBV7ow2/ibL7sxf8TPU8cqLT8dYLzvjIlCk0t1Jb86jQi5xhAvacZ+ WfUBFww9XDEJvaeOqS3oLTE5E3TeOUjz48b+F5YBOdAwFkOyu+faXg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references; s= default; bh=pXSaSw6V4qtgG+2ZU8WAbWjnHGs=; b=vT9UzxgGLn6dA2Miu751 +LrZQHHFVCBHO/kYTZz32EhGpP/QY+hE80R2cslHr2rUTjgdyFz6mreh6t1wH5Ej kMR7xRAJM+bKmL1is8eTAIO/kNLCYJ0yG7vn/HMnDeqQaEFBYxHiD7dFHIAONSLH K63wiHgurnu97FwGtdriKho= Received: (qmail 324 invoked by alias); 19 Nov 2014 10:39:25 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 32660 invoked by uid 89); 19 Nov 2014 10:39:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 19 Nov 2014 10:39:24 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sAJAdMwV018433 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 19 Nov 2014 05:39:22 -0500 Received: from c64.redhat.com (vpn-238-24.phx2.redhat.com [10.3.238.24]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sAJAdGYH026088; Wed, 19 Nov 2014 05:39:22 -0500 From: David Malcolm To: gcc-patches@gcc.gnu.org, jit@gcc.gnu.org Cc: David Malcolm Subject: [PATCH 07/21] PR jit/63854: Fix leak of optimization_summary_obstack Date: Wed, 19 Nov 2014 05:46:07 -0500 Message-Id: <1416393981-39626-8-git-send-email-dmalcolm@redhat.com> In-Reply-To: <1416393981-39626-1-git-send-email-dmalcolm@redhat.com> References: <1416393981-39626-1-git-send-email-dmalcolm@redhat.com> X-IsSubscribed: yes This was leaking ~4KB per iteration: 16,256 bytes in 4 blocks are definitely lost in loss record 234 of 239 at 0x4A0645D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x5D75C17: xmalloc (xmalloc.c:147) by 0x30958842DB: _obstack_begin (obstack.c:184) by 0x4DFECDE: bitmap_obstack_initialize(bitmap_obstack*) (bitmap.c:338) by 0x5CA3C1D: ipa_init() (ipa-reference.c:431) by 0x5CA3FB1: generate_summary() (ipa-reference.c:551) by 0x5CA4650: propagate() (ipa-reference.c:684) by 0x5CA5BEE: (anonymous namespace)::pass_ipa_reference::execute(function*) (ipa-reference.c:1178) by 0x522354D: execute_one_pass(opt_pass*) (passes.c:2306) by 0x5224427: execute_ipa_pass_list(opt_pass*) (passes.c:2700) by 0x4E495C1: ipa_passes() (cgraphunit.c:2088) by 0x4E498E0: symbol_table::compile() (cgraphunit.c:2172) gcc/ChangeLog: PR jit/63854 * ipa-reference.c (ipa_reference_c_finalize): Release optimization_summary_obstack. --- gcc/ipa-reference.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c index b421f63..1ce06d1 100644 --- a/gcc/ipa-reference.c +++ b/gcc/ipa-reference.c @@ -1193,5 +1193,9 @@ make_pass_ipa_reference (gcc::context *ctxt) void ipa_reference_c_finalize (void) { - ipa_init_p = false; + if (ipa_init_p) + { + bitmap_obstack_release (&optimization_summary_obstack); + ipa_init_p = false; + } }