This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix insn_locators leak
- From: Jan Hubicka <jh at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 11 Sep 2008 13:37:26 +0200
- Subject: Fix insn_locators leak
Hi,
this fixes memory leak on RTL insn locators. It is 4 pointers per statement.
Bootstrapped/regtested i686-linux in combined patch, will commit it after
separate bootstrap.
* function.c (free_after_compilation): Call insn_locators_free.
* cfglayout.c (insn_locators_free): New function.
* rtl.h (insn_locators_free): Declare.
Index: function.c
===================================================================
*** function.c (revision 140271)
--- function.c (working copy)
*************** free_after_compilation (struct function
*** 286,291 ****
--- 286,292 ----
f->cfg = NULL;
regno_reg_rtx = NULL;
+ insn_locators_free ();
}
/* Return size needed for stack frame based on slots so far allocated.
Index: cfglayout.c
===================================================================
*** cfglayout.c (revision 140271)
--- cfglayout.c (working copy)
*************** insn_locators_finalize (void)
*** 271,276 ****
--- 271,293 ----
curr_rtl_loc = -1;
}
+ /* Allocate insn locator datastructure. */
+ void
+ insn_locators_free (void)
+ {
+ prologue_locator = epilogue_locator = 0;
+
+ VEC_free (int, heap, block_locators_locs);
+ VEC_free (tree,gc, block_locators_blocks);
+ VEC_free (int, heap, locations_locators_locs);
+ VEC_free (location_t, heap, locations_locators_vals);
+ block_locators_locs = NULL;
+ block_locators_blocks = NULL;
+ locations_locators_locs = NULL;
+ locations_locators_vals = NULL;
+ }
+
+
/* Set current location. */
void
set_curr_insn_source_location (location_t location)
Index: rtl.h
===================================================================
*** rtl.h (revision 140271)
--- rtl.h (working copy)
*************** extern const struct rtl_hooks general_rt
*** 2357,2362 ****
--- 2357,2363 ----
#define gen_lowpart rtl_hooks.gen_lowpart
extern void insn_locators_alloc (void);
+ extern void insn_locators_free (void);
extern void insn_locators_finalize (void);
extern void set_curr_insn_source_location (location_t);
extern void set_curr_insn_block (tree);