[MLton-commit] r7446

Matthew Fluet fluet at mlton.org
Fri Mar 19 17:37:25 PST 2010


Halve backoff factor after 64 backoffs.

Results in more total backoffs, but faster convergence to maximum
available memory.
----------------------------------------------------------------------

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

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

Modified: mlton/trunk/runtime/gc/heap.c
===================================================================
--- mlton/trunk/runtime/gc/heap.c	2010-03-20 01:37:21 UTC (rev 7445)
+++ mlton/trunk/runtime/gc/heap.c	2010-03-20 01:37:24 UTC (rev 7446)
@@ -218,9 +218,11 @@
    * Always try a NULL address last.
    */
   size_t factor = 16;
+  const size_t maxFactor = s->sysvals.pageSize;
   size_t lowSize = minSize;
   size_t highSize = desiredSize;
   newSize = highSize;
+  unsigned int loopCount = 0;
   while (lowSize <= highSize) {
     pointer newStart;
 
@@ -277,6 +279,10 @@
                uintmaxToCommaString (prevSize - newSize),
                uintmaxToCommaString (minSize));
     }
+    if (factor < maxFactor
+        and ++loopCount % 64 == 0) {
+      factor += factor;
+    }
   }
   return FALSE;
 }




More information about the MLton-commit mailing list