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]

[PATCH] Fix ira-color.c memory leak


Hi!

update_cost_queue is NULL every time finish_cost_update is called
(both update_copy_costs and update_conflict_hard_regno_costs
loop until it is NULL and queue_update_cost calls are all followed
by or inside of such a loop), but what we need to actually free is
the update_cost_queue_elems array.  On a testcase with 1000 empty
functions at -O2 this leaked around 8MB of memory.

Ok for trunk?

2008-09-15  Jakub Jelinek  <jakub@redhat.com>

	* ira-color.c (finish_cost_update): Free update_cost_queue_elems
	rather than update_cost_queue.

--- gcc/ira-color.c.jj	2008-09-15 09:36:26.000000000 +0200
+++ gcc/ira-color.c	2008-09-15 17:37:19.000000000 +0200
@@ -139,7 +139,7 @@ initiate_cost_update (void)
 static void
 finish_cost_update (void)
 {
-  ira_free (update_cost_queue);
+  ira_free (update_cost_queue_elems);
 }
 
 /* When we traverse allocnos to update hard register costs, the cost

	Jakub


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