Hi, looking into malloc overhead I noticed that we do a lot of small allocations to hold file names comming from location info. This patch puts it into an obstack so it interleaves memory allocated by scc_hash less frequently. (Still we end up interleaving 64k pages which are permanent - in fact this table seems to leak from WPA and temporary during stream in)
Bootstrapped/regtested x86_64-linux. OK? Honza * lto-streamer-in.c (file_name_obstack): New obstack. (canon_file_name): Use it. (lto_reader_init): Initialize it. Index: lto-streamer-in.c =================================================================== --- lto-streamer-in.c (revision 277796) +++ lto-streamer-in.c (working copy) @@ -57,6 +57,7 @@ freeing_string_slot_hasher::remove (valu /* The table to hold the file names. */ static hash_table<freeing_string_slot_hasher> *file_name_hash_table; +static struct obstack file_name_obstack; /* Check that tag ACTUAL has one of the given values. NUM_TAGS is the @@ -113,8 +114,9 @@ canon_file_name (const char *string) char *saved_string; struct string_slot *new_slot; - saved_string = (char *) xmalloc (len + 1); - new_slot = XCNEW (struct string_slot); + saved_string = XOBNEWVEC (&file_name_obstack, char, len + 1); + new_slot = XOBNEWVAR (&file_name_obstack, + struct string_slot, sizeof (struct string_slot)); memcpy (saved_string, string, len + 1); new_slot->s = saved_string; new_slot->len = len; @@ -1723,6 +1725,7 @@ lto_reader_init (void) lto_streamer_init (); file_name_hash_table = new hash_table<freeing_string_slot_hasher> (37); + gcc_obstack_init (&file_name_obstack); }