[MLton-commit] r6604

Matthew Fluet fluet at mlton.org
Tue Apr 22 17:23:00 PDT 2008


Patch from Nicolas Bertolotti to always try to allocate a minSize heap.

----------------------------------------------------------------------

U   mlton/trunk/runtime/gc/heap.c

----------------------------------------------------------------------

Modified: mlton/trunk/runtime/gc/heap.c
===================================================================
--- mlton/trunk/runtime/gc/heap.c	2008-04-23 00:22:54 UTC (rev 6603)
+++ mlton/trunk/runtime/gc/heap.c	2008-04-23 00:22:59 UTC (rev 6604)
@@ -157,6 +157,7 @@
   assert (isHeapInit (h));
   if (desiredSize < minSize)
     desiredSize = minSize;
+  minSize = align (minSize, s->sysvals.pageSize);
   desiredSize = align (desiredSize, s->sysvals.pageSize);
   assert (0 == h->size and NULL == h->start);
   backoff = (desiredSize - minSize) / 20;
@@ -217,6 +218,10 @@
                uintmaxToCommaString (backoff),
                uintmaxToCommaString (minSize));
     }
+    /* For the last round, try to allocate minSize (and no more). */
+    if (h->size > minSize
+        and (h->size - backoff) < minSize)
+      backoff = h->size - minSize;
   }
   h->size = 0;
   return FALSE;




More information about the MLton-commit mailing list