From: "Bin.Cheng" <amker.cheng@gmail.com>
To: "Martin Liška" <mliska@suse.cz>
Cc: gcc-patches List <gcc-patches@gcc.gnu.org>,
Bin Cheng <bin.cheng@arm.com>
Subject: Re: [PATCH 7/N] Fix newly introduced memory leak in tree-ssa-loop-ivopts.c
Date: Fri, 27 Nov 2015 08:45:00 -0000 [thread overview]
Message-ID: <CAHFci29W3yoffE63qfndxQt1gV+n4JQbUaShr3g0pY-P3=PNrg@mail.gmail.com> (raw)
In-Reply-To: <56581453.7090601@suse.cz>
On Fri, Nov 27, 2015 at 4:29 PM, Martin Liška <mliska@suse.cz> wrote:
> On 11/27/2015 04:54 AM, Bin.Cheng wrote:
>> On Fri, Nov 27, 2015 at 5:08 AM, Martin Liška <mliska@suse.cz> wrote:
>>> Hi.
>>>
>>> There's one more patch that fixes really of lot memory leaks related to loop
>>> ivopts.
>>> The regression was introduced by r230647.
>>>
>>> Patch was tested in the series with the rest and the compiler bootstraps
>>> successfully.
>>>
>>> Ready for trunk?
>>
>> Hi Martin,
>> Thanks for fixing my issue. The IVO part of patch is OK.
>> Just for me to understand, iv_common_cand is freed via free_ptr_hash,
>> and thus typed_free_remove. So what leaks is the iv_use * vector in
>> struct iv_common_cand, right? I did forget to free that.
>
> Hi.
>
> You are right, the suggested patch uses delete operator for deallocation of iv_common_cand
> structure. That eventually calls dtor of auto_vec.
>
>> BTW, how do you monitor memory use in GCC, maybe I can run same test
>> for my future patches.
>
> I've been working on removal of memory leaks using valgrind, just configure the compiler with
> '--enable-valgrind-annotations' and run for instance:
>
> valgrind --leak-check=yes --trace-children=yes ./gcc/xgcc -Bgcc ../gcc/testsuite/gcc.dg/tree-ssa/loop-32.c -c -O2
>
> Producing:
> ...
> ==13919== 216 bytes in 3 blocks are definitely lost in loss record 679 of 795
> ==13919== at 0x4C2A00F: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==13919== by 0x107CEDF: xrealloc (xmalloc.c:178)
> ==13919== by 0xAC46AA: reserve<iv_use*> (vec.h:288)
> ==13919== by 0xAC46AA: reserve (vec.h:1406)
> ==13919== by 0xAC46AA: reserve_exact (vec.h:1426)
> ==13919== by 0xAC46AA: create (vec.h:1441)
> ==13919== by 0xAC46AA: record_common_cand(ivopts_data*, tree_node*, tree_node*, iv_use*) (tree-ssa-loop-ivopts.c:3133)
> ==13919== by 0xAC49C5: add_iv_candidate_for_use(ivopts_data*, iv_use*) (tree-ssa-loop-ivopts.c:3220)
> ==13919== by 0xAC4EA2: add_iv_candidate_for_uses (tree-ssa-loop-ivopts.c:3294)
> ==13919== by 0xAC4EA2: find_iv_candidates(ivopts_data*) (tree-ssa-loop-ivopts.c:5705)
> ==13919== by 0xAC839D: tree_ssa_iv_optimize_loop (tree-ssa-loop-ivopts.c:7708)
> ==13919== by 0xAC839D: tree_ssa_iv_optimize() (tree-ssa-loop-ivopts.c:7758)
> ==13919== by 0xADE4D0: (anonymous namespace)::pass_iv_optimize::execute(function*) (tree-ssa-loop.c:520)
> ==13919== by 0x920033: execute_one_pass(opt_pass*) (passes.c:2335)
> ==13919== by 0x920547: execute_pass_list_1(opt_pass*) [clone .constprop.84] (passes.c:2408)
> ==13919== by 0x920559: execute_pass_list_1(opt_pass*) [clone .constprop.84] (passes.c:2409)
> ==13919== by 0x920559: execute_pass_list_1(opt_pass*) [clone .constprop.84] (passes.c:2409)
> ==13919== by 0x9205A4: execute_pass_list(function*, opt_pass*) (passes.c:2419)
> ...
Thanks for explanation, I will do that in future.
Thanks,
bin
next prev parent reply other threads:[~2015-11-27 8:36 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-23 13:52 [PATCH 0/6] Another fixes of various memory leaks marxin
2015-11-23 13:52 ` [PATCH 3/6] Fix memory leaks in IPA devirt marxin
2015-11-23 22:38 ` Trevor Saunders
2015-11-26 21:04 ` Martin Liška
2015-11-23 13:52 ` [PATCH 2/6] Fix memory leak in tree-ssa marxin
2015-11-26 21:01 ` Martin Liška
2015-11-23 13:52 ` [PATCH 5/6] Fix parser memory leak in cilk_simd_fn_info marxin
2015-11-23 20:13 ` Jeff Law
2015-11-23 13:52 ` [PATCH 4/6] Fix memory leak in loop_vec_info marxin
2015-11-23 13:52 ` [PATCH 6/6] Fix memory leak in tree-chkp.c marxin
2015-11-23 13:53 ` [PATCH 1/6] Fix memory leak in cilk marxin
2015-11-23 20:29 ` Trevor Saunders
2015-11-26 21:00 ` Martin Liška
2015-11-27 9:23 ` Bernd Schmidt
2015-11-27 9:40 ` Martin Liška
2015-11-23 14:38 ` [PATCH 0/6] Another fixes of various memory leaks Bernd Schmidt
2015-11-23 15:12 ` Martin Liška
2015-11-26 23:21 ` [PATCH 7/N] Fix newly introduced memory leak in tree-ssa-loop-ivopts.c Martin Liška
2015-11-27 7:03 ` Bin.Cheng
2015-11-27 8:31 ` Martin Liška
2015-11-27 8:45 ` Bin.Cheng [this message]
2015-12-08 11:31 ` [PATCH 8/N] Fix memory leak in tree-vectorizer.h Martin Liška
2015-12-08 12:01 ` Richard Biener
2015-12-08 12:38 ` Richard Biener
2015-12-08 11:32 ` [PATCH 9/N] Fix memory leak tree-if-conv.c Martin Liška
2015-12-08 11:48 ` Bernd Schmidt
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='CAHFci29W3yoffE63qfndxQt1gV+n4JQbUaShr3g0pY-P3=PNrg@mail.gmail.com' \
--to=amker.cheng@gmail.com \
--cc=bin.cheng@arm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=mliska@suse.cz \
/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).