[MLton] Stack size?

Matthew Fluet fluet@cs.cornell.edu
Fri, 8 Jul 2005 12:32:11 -0400 (EDT)


> > You might be more interested in the @MLton thread-shrink-ratio 0.5
> > -- runtime option which controls how quickly a thread seen by the GC
> > has its stack shrunk to a minimal size.  (The cost of this is that
> > when a thread has been shrunk but then resumes, it will incur a GC
> > to grow to a larger size.)
> 
> Actually, thread resumption *may* incur a GC, but probably won't.  If
> there isn't enough space on the stack, resumption will invoke GC_gc,
> but this will only perform a garbage collection if there isn't space
> at the heap frontier to allocate the new, double-size, stack.

My reading is :
  GC_switchToThread checks ensureMutatorStackInvariant and possibly calls 
  doGC, which invariably does a minor GC (and may do a major GC) and then 
  copies the current stack if necessary.

So, if the stack needs to grow, we definitely perform a minorGC.