This is the mail archive of the gcc-bugs@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]

[Bug middle-end/56461] [4.8 Regression] GCC is leaking lots of memory


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56461

--- Comment #5 from Vladimir Makarov <vmakarov at gcc dot gnu.org> 2013-02-26 20:45:57 UTC ---
(In reply to comment #4)
> Created attachment 29544 [details]
> gcc48-pr56461-2.patch
> 

Sorry, I should have checked on leaks when I submitted LRA first time.
The patch is ok.

> Another leak fix, this time in lra.
> 
> ==31825== 161,960 bytes in 32 blocks are definitely lost in loss record 2,722
> of 2,737
> ==31825==    at 0x4A0881C: malloc (vg_replace_malloc.c:270)
> ==31825==    by 0x13150A7: xmalloc (xmalloc.c:147)
> ==31825==    by 0xB09EF3: lra_spill() (lra-spills.c:531)
> ==31825==    by 0xAEC826: lra(_IO_FILE*) (lra.c:2325)
> ==31825==    by 0xAA1C98: do_reload() (ira.c:4619)
> ==31825==    by 0xAA1E9C: rest_of_handle_reload() (ira.c:4731)
> ==31825==    by 0xB5BB85: execute_one_pass(opt_pass*) (passes.c:2330)
> ==31825==    by 0xB5BD79: execute_pass_list(opt_pass*) (passes.c:2378)
> ==31825==    by 0xB5BDAA: execute_pass_list(opt_pass*) (passes.c:2379)
> ==31825==    by 0x887CC5: expand_function(cgraph_node*) (cgraphunit.c:1640)
> ==31825==    by 0x888180: expand_all_functions() (cgraphunit.c:1744)
> ==31825==    by 0x888C0A: compile() (cgraphunit.c:2042)
> 
> 
> I see another issue in LRA, but don't have a fix for it yet:
> ==31825== 1,424 bytes in 1 blocks are definitely lost in loss record 2,273 of
> 2,737
> ==31825==    at 0x4A0881C: malloc (vg_replace_malloc.c:270)
> ==31825==    by 0x131514F: xrealloc (xmalloc.c:177)
> ==31825==    by 0x5FA554: void va_heap::reserve<int>(vec<int, va_heap,
> vl_embed>*&, unsigned int, bool) (vec.h:300)
> ==31825==    by 0x5FA205: vec<int, va_heap, vl_ptr>::reserve(unsigned int,
> bool) (vec.h:1468)
> ==31825==    by 0x84B952: vec<int, va_heap, vl_ptr>::reserve_exact(unsigned
> int) (vec.h:1482)
> ==31825==    by 0x84B904: vec<int, va_heap, vl_ptr>::create(unsigned int)
> (vec.h:1497)
> ==31825==    by 0xB082A9: lra_create_live_ranges(bool) (lra-lives.c:976)
> ==31825==    by 0xAEC77E: lra(_IO_FILE*) (lra.c:2295)
> ==31825==    by 0xAA1C98: do_reload() (ira.c:4619)
> ==31825==    by 0xAA1E9C: rest_of_handle_reload() (ira.c:4731)
> ==31825==    by 0xB5BB85: execute_one_pass(opt_pass*) (passes.c:2330)
> ==31825==    by 0xB5BD79: execute_pass_list(opt_pass*) (passes.c:2378)
> 
> I wonder if we shouldn't call
>   if (live_p)
>     lra_clear_live_ranges ();
> before the lra_create_live_ranges (true); call in lra.c (lra), and also call it
> when setting live_p to false.  Vlad?

Yes, it (the two lines) should be added before  lra_create_live_ranges (true)
otherwise it might be a big leak as live-ranges sometimes big.

Thanks for working on this, Jakub.


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