From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 46356 invoked by alias); 6 Nov 2015 13:43:18 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 45648 invoked by uid 89); 6 Nov 2015 13:43:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_50,KAM_ASCII_DIVIDERS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Fri, 06 Nov 2015 13:43:16 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 00A55AC77 for ; Fri, 6 Nov 2015 13:42:53 +0000 (UTC) Date: Fri, 06 Nov 2015 13:43:00 -0000 From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Fix memory leaks In-Reply-To: Message-ID: References: User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2015-11/txt/msg00630.txt.bz2 On Fri, 6 Nov 2015, Richard Biener wrote: > > A few, spotted with valgrind. One is even mine ;) > > Bootstrap and regtest running on x86_64-unknown-linux-gnu. And this is what I committed (one extra leak in postreload-gcse). Richard. 2015-11-06 Richard Biener * tree-ssa-sccvn.c (class sccvn_dom_walker): Add destructor. * lra.c (init_reg_info): Truncate copy_vec instead of re-allocating a new one and leaking the old. * ipa-inline-analysis.c (estimate_function_body_sizes): Free bb_infos vec. * sched-deps.c (sched_deps_finish): Free the dn/dl pools. * postreload-gcse.c (free_mem): Free modify_mem_list and canon_modify_mem_list. Index: gcc/tree-ssa-sccvn.c =================================================================== *** gcc/tree-ssa-sccvn.c (revision 229842) --- gcc/tree-ssa-sccvn.c (working copy) *************** class sccvn_dom_walker : public dom_walk *** 4154,4159 **** --- 4199,4205 ---- public: sccvn_dom_walker () : dom_walker (CDI_DOMINATORS), fail (false), cond_stack (vNULL) {} + ~sccvn_dom_walker (); virtual void before_dom_children (basic_block); virtual void after_dom_children (basic_block); *************** public: *** 4168,4173 **** --- 4214,4224 ---- cond_stack; }; + sccvn_dom_walker::~sccvn_dom_walker () + { + cond_stack.release (); + } + /* Record a temporary condition for the BB and its dominated blocks. */ void Index: gcc/ipa-inline-analysis.c =================================================================== *** gcc/ipa-inline-analysis.c (revision 229842) --- gcc/ipa-inline-analysis.c (working copy) *************** estimate_function_body_sizes (struct cgr *** 2853,2858 **** --- 2853,2859 ---- inline_summaries->get (node)->self_time = time; inline_summaries->get (node)->self_size = size; nonconstant_names.release (); + fbi.bb_infos.release (); if (opt_for_fn (node->decl, optimize)) { if (!early) Index: gcc/sched-deps.c =================================================================== *** gcc/sched-deps.c (revision 229842) --- gcc/sched-deps.c (working copy) *************** void *** 4092,4100 **** sched_deps_finish (void) { gcc_assert (deps_pools_are_empty_p ()); ! dn_pool->release_if_empty (); dn_pool = NULL; - dl_pool->release_if_empty (); dl_pool = NULL; h_d_i_d.release (); --- 4092,4100 ---- sched_deps_finish (void) { gcc_assert (deps_pools_are_empty_p ()); ! delete dn_pool; ! delete dl_pool; dn_pool = NULL; dl_pool = NULL; h_d_i_d.release (); Index: gcc/lra.c =================================================================== --- gcc/lra.c (revision 229843) +++ gcc/lra.c (working copy) @@ -1293,7 +1293,7 @@ init_reg_info (void) lra_reg_info = XNEWVEC (struct lra_reg, reg_info_size); for (i = 0; i < reg_info_size; i++) initialize_lra_reg_info_element (i); - copy_vec.create (100); + copy_vec.truncate (0); } Index: gcc/postreload-gcse.c =================================================================== --- gcc/postreload-gcse.c (revision 229842) +++ gcc/postreload-gcse.c (working copy) @@ -348,6 +348,8 @@ free_mem (void) BITMAP_FREE (blocks_with_calls); BITMAP_FREE (modify_mem_list_set); free (reg_avail_info); + free (modify_mem_list); + free (canon_modify_mem_list); }