Index: trunk/src/kmk/hash.c
===================================================================
--- trunk/src/kmk/hash.c	(revision 1863)
+++ trunk/src/kmk/hash.c	(revision 1864)
@@ -246,4 +246,22 @@
 }
 
+#ifdef CONFIG_WITH_ALLOC_CACHES
+void
+hash_free_items_cached (struct hash_table *ht, struct alloccache *cache)
+{
+  void **vec = ht->ht_vec;
+  void **end = &vec[ht->ht_size];
+  for (; vec < end; vec++)
+    {
+      void *item = *vec;
+      if (!HASH_VACANT (item))
+	alloccache_free (cache, item);
+      *vec = 0;
+    }
+  ht->ht_fill = 0;
+  ht->ht_empty_slots = ht->ht_size;
+}
+#endif /* CONFIG_WITH_ALLOC_CACHES */
+
 void
 hash_delete_items (struct hash_table *ht)
@@ -275,4 +293,21 @@
 }
 
+#ifdef CONFIG_WITH_ALLOC_CACHES
+void
+hash_free_cached (struct hash_table *ht, int free_items, struct alloccache *cache)
+{
+  if (free_items)
+    hash_free_items_cached (ht, cache);
+  else
+    {
+      ht->ht_fill = 0;
+      ht->ht_empty_slots = ht->ht_size;
+    }
+  free (ht->ht_vec);
+  ht->ht_vec = 0;
+  ht->ht_capacity = 0;
+}
+#endif /* CONFIG_WITH_ALLOC_CACHES */
+
 void
 hash_map (struct hash_table *ht, hash_map_func_t map)
Index: trunk/src/kmk/hash.h
===================================================================
--- trunk/src/kmk/hash.h	(revision 1863)
+++ trunk/src/kmk/hash.h	(revision 1864)
@@ -75,4 +75,8 @@
 void hash_free_items __P((struct hash_table *ht));
 void hash_free __P((struct hash_table *ht, int free_items));
+#ifdef CONFIG_WITH_ALLOC_CACHES
+void hash_free_items_cached __P((struct hash_table *ht, struct alloccache *cache));
+void hash_free_cached __P((struct hash_table *ht, int free_items, struct alloccache *cache));
+#endif
 void hash_map __P((struct hash_table *ht, hash_map_func_t map));
 void hash_map_arg __P((struct hash_table *ht, hash_map_arg_func_t map, void *arg));
Index: trunk/src/kmk/implicit.c
===================================================================
--- trunk/src/kmk/implicit.c	(revision 1863)
+++ trunk/src/kmk/implicit.c	(revision 1864)
@@ -265,5 +265,5 @@
 #ifdef CONFIG_WITH_ALLOC_CACHES
   if (!idep_cache.size)
-    alloccache_init (&idep_cache, sizeof(struct idep), "dep", NULL, NULL);
+    alloccache_init (&idep_cache, sizeof (struct idep), "idep", NULL, NULL);
 #endif
 
Index: trunk/src/kmk/main.c
===================================================================
--- trunk/src/kmk/main.c	(revision 1863)
+++ trunk/src/kmk/main.c	(revision 1864)
@@ -648,11 +648,15 @@
 struct alloccache nameseq_cache;
 struct alloccache variable_cache;
+struct alloccache variable_set_cache;
+struct alloccache variable_set_list_cache;
 
 static void
 initialize_global_alloc_caches (void)
 {
-  alloccache_init (&dep_cache,      sizeof (struct dep),      "dep",      NULL, NULL);
-  alloccache_init (&nameseq_cache,  sizeof (struct nameseq),  "nameseq",  NULL, NULL);
-  alloccache_init (&variable_cache, sizeof (struct variable), "variable", NULL, NULL);
+  alloccache_init (&dep_cache,               sizeof (struct dep),               "dep",               NULL, NULL);
+  alloccache_init (&nameseq_cache,           sizeof (struct nameseq),           "nameseq",           NULL, NULL);
+  alloccache_init (&variable_cache,          sizeof (struct variable),          "variable",          NULL, NULL);
+  alloccache_init (&variable_set_cache,      sizeof (struct variable_set),      "variable_set",      NULL, NULL);
+  alloccache_init (&variable_set_list_cache, sizeof (struct variable_set_list), "variable_set_list", NULL, NULL);
 }
 #endif
@@ -2933,5 +2937,5 @@
   if (!remote_description || *remote_description == '\0')
     printf (_("\nThis program is built for %s/%s/%s [" __DATE__ " " __TIME__ "]\n"),
-            KBUILD_HOST, KBUILD_HOST_ARCH, KBUILD_HOST_CPU, remote_description);
+            KBUILD_HOST, KBUILD_HOST_ARCH, KBUILD_HOST_CPU);
   else
     printf (_("\nThis program is built for %s/%s/%s (%s) [" __DATE__ " " __TIME__ "]\n"),
Index: trunk/src/kmk/make.h
===================================================================
--- trunk/src/kmk/make.h	(revision 1863)
+++ trunk/src/kmk/make.h	(revision 1864)
@@ -575,4 +575,6 @@
 extern struct alloccache nameseq_cache;
 extern struct alloccache variable_cache;
+extern struct alloccache variable_set_cache;
+extern struct alloccache variable_set_list_cache;
 
 #endif /* CONFIG_WITH_ALLOC_CACHES */
Index: trunk/src/kmk/misc.c
===================================================================
--- trunk/src/kmk/misc.c	(revision 1863)
+++ trunk/src/kmk/misc.c	(revision 1864)
@@ -1286,5 +1286,6 @@
 alloccache_print (struct alloccache *cache)
 {
-  printf (_("\n# Alloc Cache: %s item size: %u  alloc: %d  total: %u\n"),
+  printf (_("\n# Alloc Cache: %s\n"
+              "#  Items: size = %-3u  in-use = %-6d  total = %-6u\n"),
           cache->name, cache->size, (int)cache->alloc_count, cache->total_count);
 }
@@ -1295,4 +1296,5 @@
 {
   struct alloccache *cur;
+  puts ("");
   for (cur = alloccache_head; cur; cur = cur->next)
     alloccache_print (cur);
Index: trunk/src/kmk/variable.c
===================================================================
--- trunk/src/kmk/variable.c	(revision 1863)
+++ trunk/src/kmk/variable.c	(revision 1864)
@@ -707,5 +707,9 @@
   /* Create a new variable definition and add it to the hash table.  */
 
+#ifndef CONFIG_WITH_ALLOC_CACHES
   v = xmalloc (sizeof (struct variable));
+#else
+  v = alloccache_alloc (&variable_cache);
+#endif
   v->name = savestring (name, length);
   v->length = length;
@@ -1016,7 +1020,14 @@
   if (l == 0)
     {
+#ifndef CONFIG_WITH_ALLOC_CACHES
       l = (struct variable_set_list *)
 	xmalloc (sizeof (struct variable_set_list));
       l->set = xmalloc (sizeof (struct variable_set));
+#else
+      l = (struct variable_set_list *)
+        alloccache_alloc (&variable_set_list_cache);
+      l->set = (struct variable_set *)
+        alloccache_alloc (&variable_set_cache);
+#endif
       hash_init (&l->set->table, PERFILE_VARIABLE_BUCKETS,
                  variable_hash_1, variable_hash_2, variable_hash_cmp);
@@ -1121,10 +1132,19 @@
   register struct variable_set *set;
 
+#ifndef CONFIG_WITH_ALLOC_CACHES
   set = xmalloc (sizeof (struct variable_set));
+#else
+  set = (struct variable_set *) alloccache_alloc (&variable_set_cache);
+#endif
   hash_init (&set->table, SMALL_SCOPE_VARIABLE_BUCKETS,
 	     variable_hash_1, variable_hash_2, variable_hash_cmp);
 
+#ifndef CONFIG_WITH_ALLOC_CACHES
   setlist = (struct variable_set_list *)
     xmalloc (sizeof (struct variable_set_list));
+#else
+  setlist = (struct variable_set_list *)
+    alloccache_alloc (&variable_set_list_cache);
+#endif
   setlist->set = set;
   setlist->next = current_variable_set_list;
@@ -1145,7 +1165,13 @@
 {
   hash_map (&list->set->table, free_variable_name_and_value);
+#ifndef CONFIG_WITH_ALLOC_CACHES
   hash_free (&list->set->table, 1);
   free (list->set);
   free (list);
+#else
+  hash_free_cached (&list->set->table, 1, &variable_cache);
+  alloccache_free (&variable_set_cache, list->set);
+  alloccache_free (&variable_set_list_cache, list);
+#endif
 }
 
@@ -1203,8 +1229,15 @@
 
   /* Free the one we no longer need.  */
+#ifndef CONFIG_WITH_ALLOC_CACHES
   free (setlist);
   hash_map (&set->table, free_variable_name_and_value);
   hash_free (&set->table, 1);
   free (set);
+#else
+  alloccache_free (&variable_set_list_cache, setlist);
+  hash_map (&set->table, free_variable_name_and_value);
+  hash_free_cached (&set->table, 1, &variable_cache);
+  alloccache_free (&variable_set_cache, set);
+#endif
 }
 
