On Fri, Sep 27, 2002 at 12:25:31PM +0100, Simon Marlow wrote:
Then I'll reformulate my question as a patch. Enclosed is a proof-of-concept patch that implements Haskell finalizers in Hugs, which works on some simple tests that I've run. There's nothing particularly clever going on - I'm just suspending execution of the finalizers until the next call to eval().
It seems to have problems if more than one finalizer is pending, probably because runIO() calls eval():
t = do sequence_ (map f [1..30]) performGC where f n = do p <- mallocBytes 64 newForeignPtr p $ do free p putStrLn ("finalize " ++ show n)
Looks like I missed out a pop() - the enclosed patch works with your example. (I'm not very familiar with the internals of Hugs). Cheers, Simon
participants (1)
-
Simon Marlow