Index: trunk/src/kmk/function.c
===================================================================
--- trunk/src/kmk/function.c	(revision 1985)
+++ trunk/src/kmk/function.c	(revision 1986)
@@ -119,6 +119,6 @@
 #ifdef CONFIG_WITH_MAKE_STATS
 long          make_stats_allocations = 0;
+long          make_stats_reallocations = 0;
 unsigned long make_stats_allocated = 0;
-unsigned long make_stats_allocated_sum = 0;
 unsigned long make_stats_ht_lookups = 0;
 unsigned long make_stats_ht_collisions = 0;
@@ -4233,8 +4233,8 @@
     {
 # ifdef CONFIG_WITH_MAKE_STATS
-      len = sprintf (buf, "alloc-cur: %5ld %6luKB (/%3luMB)  hash: %5lu %2lu%%",
+      len = sprintf (buf, "alloc-cur: %5ld/%3ld %3luMB  hash: %5lu %2lu%%",
                      make_stats_allocations,
-                     make_stats_allocated / 1024,
-                     make_stats_allocated_sum / (1024*1024),
+                     make_stats_reallocations,
+                     make_stats_allocated / (1024*1024),
                      make_stats_ht_lookups,
                      (make_stats_ht_collisions * 100) / make_stats_ht_lookups);
@@ -4256,8 +4256,8 @@
           else if (!strcmp(argv[i], "allocations"))
             val = make_stats_allocations;
+          else if (!strcmp(argv[i], "reallocations"))
+            val = make_stats_reallocations;
           else if (!strcmp(argv[i], "allocated"))
             val = make_stats_allocated;
-          else if (!strcmp(argv[i], "allocated_sum"))
-            val = make_stats_allocated_sum;
           else if (!strcmp(argv[i], "ht_lookups"))
             val = make_stats_ht_lookups;
@@ -4639,5 +4639,5 @@
   { STRING_SIZE_TUPLE("libpath"),       1,  2,  1,  func_os2_libpath},
 #endif
-#ifdef CONFIG_WITH_MAKE_STATS
+#if defined (CONFIG_WITH_MAKE_STATS) || defined (CONFIG_WITH_MINIMAL_STATS)
   { STRING_SIZE_TUPLE("make-stats"),    0,  0,  0,  func_make_stats},
 #endif
Index: trunk/src/kmk/make.h
===================================================================
--- trunk/src/kmk/make.h	(revision 1985)
+++ trunk/src/kmk/make.h	(revision 1986)
@@ -208,6 +208,6 @@
 #ifdef CONFIG_WITH_MAKE_STATS
 extern long make_stats_allocations;
+extern long make_stats_reallocations;
 extern unsigned long make_stats_allocated;
-extern unsigned long make_stats_allocated_sum;
 extern unsigned long make_stats_ht_lookups;
 extern unsigned long make_stats_ht_collisions;
@@ -215,5 +215,5 @@
 # ifdef __APPLE__
 #  include <malloc/malloc.h>
-#  define SIZE_OF_HEAP_BLOCK(ptr)   malloc_size(ptr)
+#  define SIZE_OF_HEAP_BLOCK(ptr)   malloc_good_size(ptr)
 
 # elif defined(__linux__) /* glibc */
@@ -228,9 +228,4 @@
 #  define SIZE_OF_HEAP_BLOCK(ptr)   0
 #endif
-
-# if defined(CONFIG_WITH_MAKE_STATS) && !defined(ELECTRIC_HEAP)
-#  define free xfree
-extern void xfree (void *);
-# endif
 
 # define MAKE_STATS_3(expr) do { expr; } while (0)
Index: trunk/src/kmk/misc.c
===================================================================
--- trunk/src/kmk/misc.c	(revision 1985)
+++ trunk/src/kmk/misc.c	(revision 1986)
@@ -398,12 +398,11 @@
   if (result == 0)
     fatal (NILF, _("virtual memory exhausted"));
+
 #ifdef CONFIG_WITH_MAKE_STATS
   make_stats_allocations++;
   if (make_expensive_statistics)
-    {
-      unsigned int actual_size = SIZE_OF_HEAP_BLOCK (result);
-      make_stats_allocated += actual_size;
-      make_stats_allocated_sum += actual_size;
-    }
+    make_stats_allocated += SIZE_OF_HEAP_BLOCK (result);
+  else
+    make_stats_allocated += size;
 #endif
   return result;
@@ -417,9 +416,9 @@
 #ifdef CONFIG_WITH_MAKE_STATS
   if (make_expensive_statistics && ptr != NULL)
-    {
-      unsigned int actual_size = SIZE_OF_HEAP_BLOCK (ptr);
-      make_stats_allocated -= actual_size;
-      make_stats_allocated_sum -= actual_size;
-    }
+    make_stats_allocated -= SIZE_OF_HEAP_BLOCK (ptr);
+  if (ptr)
+    make_stats_reallocations++;
+  else
+    make_stats_allocations++;
 #endif
 
@@ -430,13 +429,10 @@
   if (result == 0)
     fatal (NILF, _("virtual memory exhausted"));
+
 #ifdef CONFIG_WITH_MAKE_STATS
-  if (!ptr)
-    make_stats_allocations++;
   if (make_expensive_statistics)
-    {
-      unsigned int actual_size = SIZE_OF_HEAP_BLOCK (result);
-      make_stats_allocated += actual_size;
-      make_stats_allocated_sum += actual_size;
-    }
+    make_stats_allocated += SIZE_OF_HEAP_BLOCK (result);
+  else
+    make_stats_allocated += size;
 #endif
   return result;
@@ -461,9 +457,7 @@
   make_stats_allocations++;
   if (make_expensive_statistics)
-    {
-      unsigned int actual_size = SIZE_OF_HEAP_BLOCK (result);
-      make_stats_allocated += actual_size;
-      make_stats_allocated_sum += actual_size;
-    }
+    make_stats_allocated += SIZE_OF_HEAP_BLOCK (result);
+  else
+    make_stats_allocated += strlen (ptr) + 1;
 #endif
 #ifdef HAVE_STRDUP
@@ -1165,19 +1159,4 @@
 }
 
-#if defined(CONFIG_WITH_MAKE_STATS) && !defined(ELECTRIC_HEAP)
-#undef free
-void xfree(void *ptr)
-{
-  if (ptr)
-    {
-      make_stats_allocations--;
-      if (make_expensive_statistics)
-        make_stats_allocated -= SIZE_OF_HEAP_BLOCK (ptr);
-      free (ptr);
-    }
-}
-#endif
-
-
 #ifdef CONFIG_WITH_ALLOC_CACHES
 
@@ -1403,4 +1382,11 @@
 # endif /* __GLIBC__ */
 
+# ifdef CONFIG_WITH_MAKE_STATS
+  printf(_("#            %lu malloc calls,  %lu realloc calls\n"),
+         make_stats_allocations, make_stats_reallocations);
+  printf(_("#            %lu MBs alloc sum, not counting freed, add pinch of salt\n"), /* XXX: better wording */
+         make_stats_allocated / (1024*1024));
+# endif
+
   /* XXX: windows */
 }
