* Fix insn_locators memory leak
@ 2008-09-11 11:38 Jan Hubicka
0 siblings, 0 replies; only message in thread
From: Jan Hubicka @ 2008-09-11 11:38 UTC (permalink / raw)
To: gcc-patches
Hi,
this fixes memory leak on RTL insn locators.
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 ();
}
\f
/* 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);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-09-11 11:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-11 11:38 Fix insn_locators memory leak Jan Hubicka
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).