public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "marxin at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/65538] [5 Regression] Memory leak of ipa_node_params_sum elements
Date: Tue, 24 Mar 2015 10:51:00 -0000	[thread overview]
Message-ID: <bug-65538-4-x4HQwarsaJ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-65538-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65538

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #0)
> Seen recently in valgrind output (e.g. on the pr65533.c testcase):
> 
> ==19246== 216 (48 direct, 168 indirect) bytes in 1 blocks are definitely
> lost in loss record 501 of 594
> ==19246==    at 0x4A070D7: operator new(unsigned long) (in
> /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==19246==    by 0xAEBAAE: function_summary<ipa_node_params*>::allocate_new()
> (symbol-summary.h:106)
> ==19246==    by 0xAEAF20: function_summary<ipa_node_params*>::get(int)
> (symbol-summary.h:232)
> ==19246==    by 0xAE9B97:
> function_summary<ipa_node_params*>::get(cgraph_node*) (symbol-summary.h:112)
> ==19246==    by 0xAF9C38: ipa_analyze_node(cgraph_node*) (ipa-prop.c:2386)
> ==19246==    by 0x15B5578: ipcp_generate_summary() (ipa-cp.c:4449)
> ==19246==    by 0xC255AF: execute_ipa_summary_passes(ipa_opt_pass_d*)
> (passes.c:2154)
> ==19246==    by 0x841202: ipa_passes() (cgraphunit.c:2179)
> ==19246==    by 0x8415E5: symbol_table::compile() (cgraphunit.c:2295)
> ==19246==    by 0x841907: symbol_table::finalize_compilation_unit()
> (cgraphunit.c:2444)
> ==19246==    by 0x69CEB8: c_write_global_declarations() (c-decl.c:10801)
> ==19246==    by 0xD1EBAC: compile_file() (toplev.c:608)
> ==19246== 
> ==19246== 384 (192 direct, 192 indirect) bytes in 4 blocks are definitely
> lost in loss record 519 of 594
> ==19246==    at 0x4A070D7: operator new(unsigned long) (in
> /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==19246==    by 0xAEBAAE: function_summary<ipa_node_params*>::allocate_new()
> (symbol-summary.h:106)
> ==19246==    by 0xAEAF20: function_summary<ipa_node_params*>::get(int)
> (symbol-summary.h:232)
> ==19246==    by 0xAE9B97:
> function_summary<ipa_node_params*>::get(cgraph_node*) (symbol-summary.h:112)
> ==19246==    by 0xAF42FC: ipa_initialize_node_params(cgraph_node*)
> (ipa-prop.c:293)
> ==19246==    by 0xAE323D: estimate_function_body_sizes(cgraph_node*, bool)
> (ipa-inline-analysis.c:2518)
> ==19246==    by 0xAE4F54: compute_inline_parameters(cgraph_node*, bool)
> (ipa-inline-analysis.c:2951)
> ==19246==    by 0xAE5051: compute_inline_parameters_for_current()
> (ipa-inline-analysis.c:2978)
> ==19246==    by 0xAE50D8: (anonymous
> namespace)::pass_inline_parameters::execute(function*)
> (ipa-inline-analysis.c:3008)
> ==19246==    by 0xC25B24: execute_one_pass(opt_pass*) (passes.c:2328)
> ==19246==    by 0xC25D5E: execute_pass_list_1(opt_pass*) (passes.c:2380)
> ==19246==    by 0xC25DCC: execute_pass_list(function*, opt_pass*)
> (passes.c:2391)
> 
> inline summaries are ggc allocated and so not a problem, but the ipa-prop
> summaries are not, and thus something should arrange that the
> ipa_node_params class objects allocated by allocate_new are destructed when
> m_map is destructed.
> So, perhaps summary_hashmap_traits needs to implement the remove template
> method?  Though, it is unclear how it could find out if the hash_map is ggc
> or not.  Perhaps the decision ggc vs. non-ggc should be done as
> function_summary template parameter or similar.

I think the correct way is to traverse all items in
function_summary<T>::release (in case of GGC-based map) and delete them all.

Working on the patch.

Martin
>From gcc-bugs-return-481384-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Mar 24 10:34:34 2015
Return-Path: <gcc-bugs-return-481384-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 5639 invoked by alias); 24 Mar 2015 10:34:34 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 118370 invoked by uid 48); 24 Mar 2015 10:34:31 -0000
From: "paolo.carlini at oracle dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/59978] C++11 Non-Type-Template-Parameter Pack Expansion not working according to standard
Date: Tue, 24 Mar 2015 10:51:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.8.2
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: paolo.carlini at oracle dot com
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status cf_reconfirmed_on everconfirmed
Message-ID: <bug-59978-4-oUFnYgtYyY@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59978-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59978-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-03/txt/msg02528.txt.bz2
Content-length: 407

https://gcc.gnu.org/bugzilla/show_bug.cgi?idY978

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-03-24
     Ever confirmed|0                           |1


  parent reply	other threads:[~2015-03-24 10:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-24  9:32 [Bug tree-optimization/65538] New: " jakub at gcc dot gnu.org
2015-03-24  9:44 ` [Bug tree-optimization/65538] " jakub at gcc dot gnu.org
2015-03-24 10:34 ` rguenth at gcc dot gnu.org
2015-03-24 10:51 ` marxin at gcc dot gnu.org [this message]
2015-03-25 12:53 ` marxin at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-65538-4-x4HQwarsaJ@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).