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] Free memory in et-forest


et-forest does not correctly free its memory as one can see from
-fmem-report:

Alloc-pool Kind        Pools  Allocated      Peak        Leak
et_occ pool                1    5034672    1999480    1999480
et_node pool               1    2795848     541528     541528

with the following patch we now have:

et_occ pool                7    5034672     886256          0
et_node pool               7    2795848     541528          0

Bootstrapped and tested on x86_64-unknown-linux-gnu.

Ok for mainline?

(after this last patch in the series, tramp3d build-time memory
requirements dropped by 11%)

Thanks,
Richard.

:ADDPATCH middle-end:

2006-06-15  Michael Matz  <matz@suse.de>
	Richard Guenther  <rguenther@suse.de>

	* et-forest.c (et_free_tree_force): Correctly free the
	et-forest pools.

Index: et-forest.c
===================================================================
--- et-forest.c	(Revision 114599)
+++ et-forest.c	(Arbeitskopie)
@@ -505,7 +505,19 @@ void
 et_free_tree_force (struct et_node *t)
 {
   pool_free (et_occurrences, t->rightmost_occ);
+  if (t->parent_occ)
+    pool_free (et_occurrences, t->parent_occ);
+  if (et_occurrences->elts_free == et_occurrences->elts_allocated)
+    {
+      free_alloc_pool (et_occurrences);
+      et_occurrences = NULL;
+    }
   pool_free (et_nodes, t);
+  if (et_nodes->elts_free == et_nodes->elts_allocated)
+    {
+      free_alloc_pool (et_nodes);
+      et_nodes = NULL;
+    }
 }
 
 /* Sets father of et tree T to FATHER.  */


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