According to profiling messages that I'm generating, when a stand-alone
executable terminates, any remaining finalizers (added with
CInterface.setFinal) are not run. Consequently, resources that should
be freed may not be. I think I would probably expect the semantics of
finalizers to be such that they are run at some point before the program
terminates. Does that sound sensible?
This can be worked around easily, for example by creating a variant of
PolyML.export that adds a final PolyML.fullGC to the exported function
(for both normal and exception paths). However, there is the question
of whether, on termination, a full GC is needed or does a call to each
finalizer suffice. If it is the latter, the work-around with an
explicit GC does more work than required.
By comparison, for stand-alone executables created with MLton, any
remaining finalizers (added with MLton.Finalizable.addFinalizer) are
called prior to termination - possibly due to a final GC, I don't know.
Phil
_______________________________________________
polyml mailing list
polyml@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml