[Haskell-cafe] Confusing change causing space leak

Denis Bueno dbueno at gmail.com
Fri Apr 24 12:51:35 EDT 2009


Hi all,

I discussed this with a few people in #haskell-in-depth, and we
thought I should send this to the list.

The following paste shows the only changes required to remove a space
leak: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=4185#a4185.
Summary: if I reduce a tuple-from-IO to whnf in the "allocate"
function passed to "bracket", no leak.  For example, this also doesn't
leak: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=4185#a4189

That paste page also contains the code for "externalSort".  The
"externalSort" function used in the example corresponds to the "sort"
function provided by the Algorithms.ExternalSort module.

Can anyone explain why the leak happens at all, or why it goes away?
                              Denis


More information about the Haskell-Cafe mailing list