Under what conditions are finalizers not run?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Under what conditions are finalizers not run?

Wolfgang Jeltsch-2
Hi,

the documentation of System.Mem.Weak under

    <http://hackage.haskell.org/package/base-4.7.0.1/docs/System-Mem-Weak.html>

says the following:

> It is not guaranteed that a finalizer will eventually run, and no
> attempt is made to run outstanding finalizers when the program exits.

In which situations are finalizers not run? I see that they might not be
run when the program ends while the weak pointer is still alive, but are
there also other situations? The above quote seems to say that even an
implementation that ignores any finalizers would conform to the API
specification.

I think it is actually quite bad if you do not have any guarantees about
when finalizers are run. In the memo table example, for instance, this
would mean that the memo table could grow very large, which would not
just result in bad space complexity, but also bad time complexity for
lookups.

I am actually particularly interested in adding finalizers to IORefs.
Are there any stronger guarantees for finalizers attached to IORefs and
MVars?

All the best,
Wolfgang

_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users