This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 04/21] PR jit/63854: Fix memory leak within bb-reorder.c


On Wed, Nov 19, 2014 at 11:46 AM, David Malcolm <dmalcolm@redhat.com> wrote:
> Valgrind showed this leaking 200 bytes per iteration in one of
> my testcases:

Ok.

Thanks,
Richard.

> 1,000 bytes in 5 blocks are definitely lost in loss record 200 of 241
>    at 0x4A083AA: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
>    by 0x5D75C5C: xrealloc (xmalloc.c:179)
>    by 0x4E10734: void va_heap::reserve<basic_block_def*>(vec<basic_block_def*, va_heap, vl_embed>*&, unsigned int, bool) (vec.h:310
> )
>    by 0x4E105BB: vec<basic_block_def*, va_heap, vl_ptr>::reserve(unsigned int, bool) (vec.h:1428)
>    by 0x4E15B37: vec<basic_block_def*, va_heap, vl_ptr>::safe_push(basic_block_def* const&) (vec.h:1537)
>    by 0x5B61F44: find_rarely_executed_basic_blocks_and_crossing_edges() (bb-reorder.c:1614)
>    by 0x5B63E90: (anonymous namespace)::pass_partition_blocks::execute(function*) (bb-reorder.c:2711)
>    by 0x522354D: execute_one_pass(opt_pass*) (passes.c:2306)
>    by 0x52237C4: execute_pass_list_1(opt_pass*) (passes.c:2358)
>    by 0x52237F5: execute_pass_list_1(opt_pass*) (passes.c:2359)
>    by 0x5223832: execute_pass_list(function*, opt_pass*) (passes.c:2369)
>    by 0x4E4884F: cgraph_node::expand() (cgraphunit.c:1773)
>
> Fix is trivial.
>
> gcc/ChangeLog:
>         PR jit/63854
>         * bb-reorder.c
>         (find_rarely_executed_basic_blocks_and_crossing_edges): Convert
>         local bbs_in_hot_partition from vec<> to auto_vec<>.
> ---
>  gcc/bb-reorder.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c
> index 1f7c3ee..4ca3bb2 100644
> --- a/gcc/bb-reorder.c
> +++ b/gcc/bb-reorder.c
> @@ -1582,7 +1582,7 @@ find_rarely_executed_basic_blocks_and_crossing_edges (void)
>    edge e;
>    edge_iterator ei;
>    unsigned int cold_bb_count = 0;
> -  vec<basic_block> bbs_in_hot_partition = vNULL;
> +  auto_vec<basic_block> bbs_in_hot_partition;
>
>    /* Mark which partition (hot/cold) each basic block belongs in.  */
>    FOR_EACH_BB_FN (bb, cfun)
> --
> 1.8.5.3
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]