[MLton-user] Does GC always trigger MLtonFinalizable?

Tom Murphy twm at andrew.cmu.edu
Sat Feb 17 17:05:57 PST 2007


Out of curiosity, when the program ends, how can there be any live data 
at all? Are globals still considered live?

  - Tom

Matthew Fluet wrote:
> 
>> So, my original question again: does a GC collect promise to run all 
>> finalizers for all unreferenced objects?
> 
> Sort of.  The code promises to run the finalizers for all objects that 
> were determined to be unreferenced during the GC.  However, if some 
> additional objects become unreferenced as a consequence of running the 
> finalizers (say, because an object being finalized this round is holding 
> the last reference to another finalized object), then their finalizers 
> won't run until the next garbage collection.
> 
> At program exit, we do run finalizers to quiescence, by repeatedly 
> invoking the garbage collector.  Since the program is about to exit, 
> there can't be too much live data around, so these collections should be 
> fast, and quiescence should be reached quickly.
> 
> 
> 
> _______________________________________________
> MLton-user mailing list
> MLton-user at mlton.org
> http://mlton.org/mailman/listinfo/mlton-user
> 



More information about the MLton-user mailing list