Free constructor elts in LTO merging

Jan Hubicka hubicka@ucw.cz
Thu Feb 6 17:04:00 GMT 2014


Hi,
according to memory stats this is relatively common reason for garbage left
after tree merging.

Bootstrapped/regtested x86_64-linux, OK?

Honza

	* lto/lto.c (unify_scc): Free also CONSTRUCTOR_ELTS.
Index: lto/lto.c
===================================================================
--- lto/lto.c	(revision 207515)
+++ lto/lto.c	(working copy)
@@ -1807,8 +1807,13 @@ unify_scc (struct streamer_tree_cache_d
 	  /* Free the tree nodes from the read SCC.  */
 	  for (unsigned i = 0; i < len; ++i)
 	    {
+	      enum tree_code code;
 	      if (TYPE_P (scc->entries[i]))
 		num_merged_types++;
+	      code = TREE_CODE (scc->entries[i]);
+	      if (CODE_CONTAINS_STRUCT (code, TS_CONSTRUCTOR)
+		  && CONSTRUCTOR_ELTS (scc->entries[i]))
+		ggc_free (CONSTRUCTOR_ELTS (scc->entries[i]));
 	      ggc_free (scc->entries[i]);
 	    }
 



More information about the Gcc-patches mailing list