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: memory leak in reorg_loops


On 01/07/14 06:57, Richard Biener wrote:
On Mon, Jan 6, 2014 at 6:24 PM, Jeff Law <law@redhat.com> wrote:
On 01/02/14 19:31, dxq wrote:

hi,

In hw-doloop.c,  is there a memory leak?

valgrind checking shows:

==18622== 1,479,296 bytes in 364 blocks are definitely lost in loss record
559 of 559
==18622==    at 0x4006ADD: malloc (vg_replace_malloc.c:291)
==18622==    by 0x8C0A9D5: xmalloc (xmalloc.c:147)
==18622==    by 0x910457: _obstack_begin (in /lib/libc-2.5.so)
==18622==    by 0x81EDD24: bitmap_obstack_initialize (bitmap.c:318)
==18622==    by 0x8B22BBE: reorg_loops (hw-doloop.c:635)
...
...
==18622==    by 0x8688B3E: rest_of_handle_machine_reorg (reorg.c:4183)
==18622==    by 0x861D2A6: execute_one_pass (passes.c:2097)
==18622==    by 0x861D6A0: execute_pass_list (passes.c:2152)
==18622==    by 0x861D6BC: execute_pass_list (passes.c:2153)
==18622==    by 0x861D6BC: execute_pass_list (passes.c:2153)

should loop_stack be freed at the end of reorg_loops? please confirm!
if it's true, commit for me, thanks!

      free_loops (loops);
+  bitmap_obstack_release (&loop_stack);

     if (dump_file)
       print_rtl (dump_file, get_insns ());

thanks!

Isn't the bitmap free'd from within free_loops?

It isn't (it's hw-doloops 'loop' structures).
I realize it's hw-doloops loop structures. I was referring to the BITMAP_FREE of the underlying bitmaps in free_loops. But if I'm reading everything correctly that puts stuff on the free list. To actually release things back we need the bitmap_obstack_release.

The patch is ok.
Installed.

Jeff


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