On Tue, Mar 23, 2010 at 10:20 PM, Simon Marlow <marlo...@gmail.com> wrote: > The leak is caused by the Data.Unique library, and coincidentally it was > fixed recently. 6.12.2 will have the fix.
Oh yes of course, I've reported that bug myself but didn't realize it was the problem here :-) David, to clarify the problem: newUnqiue is currently implemented as: newUnique :: IO Unique newUnique = do val <- takeMVar uniqSource let next = val+1 putMVar uniqSource next return (Unique next) You can see that the 'next' value is lazily written to the uniqSource MVar. When you repeatedly call newUnique (like in your example) a big thunk is build up: 1+1+1+...+1 which causes the space-leak. In the recent fix, 'next' is strictly evaluated before it is written to the MVar which prevents a big thunk to build up. regards, Bas _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe