[MLton-commit] r6608

Vesa Karvonen vesak at mlton.org
Thu Apr 24 07:27:25 PDT 2008


Loop over lists (of declarations) rather than vectors (of ...) in the
translation pass, because this allows the elements to be GC'ed, which
reduces the memory requirements dramatically (verified by monitoring
process memory usage).

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

U   mlton/trunk/mlton/defunctorize/defunctorize.fun

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

Modified: mlton/trunk/mlton/defunctorize/defunctorize.fun
===================================================================
--- mlton/trunk/mlton/defunctorize/defunctorize.fun	2008-04-23 00:23:08 UTC (rev 6607)
+++ mlton/trunk/mlton/defunctorize/defunctorize.fun	2008-04-24 14:27:24 UTC (rev 6608)
@@ -912,7 +912,10 @@
                end
          end
       and loopDecs (ds: Cdec.t vector, (e: Xexp.t, t: Xtype.t)): Xexp.t =
-         Vector.foldr (ds, e, fn (d, e) => loopDec (d, e, t))
+         loopDecsList (Vector.toList ds, (e, t))
+      (* Convert vector->list to allow processed Cdecs to be GC'ed. *)
+      and loopDecsList (ds: Cdec.t list, (e: Xexp.t, t: Xtype.t)): Xexp.t =
+         List.foldr (ds, e, fn (d, e) => loopDec (d, e, t))
       and loopExp (e: Cexp.t): Xexp.t * Xtype.t =
          let
             val (n, ty) = Cexp.dest e




More information about the MLton-commit mailing list