iteratee patch: unfoldConvStream: workaround for space leak problem

John Lato jwlato at
Wed Feb 9 14:01:58 GMT 2011

Thanks very much for this patch.  It looks like most of the problems
associated with have been fixed by now, so
hopefully discussions and submissions will proceed smoothly in the

I provided an alternative unfoldConvStream to Maciej privately, have
you had an opportunity to compare the two?  I prefer my proposed
definition because it has fewer local bindings and also lifts the
binding of "f" outside the recursive calls, however I don't know if it
actually solves the space leak.

There may be some other affected functions.  In general the iteratee
code avoids recursion on top-level definitions, so most of the code
should be ok.  I distinctly remember making a decision to use
recursion on the top-level of unfoldConvStream because it seemed
cleaner than alternatives, so it's very possible other more complex
and/or newer definitions suffer as well.


On 2/8/11, Akio Takano <tkn.akio at> wrote:
> Hi,
> Attached is a proposed patch for the space leak problem discussed by
> Maciej Wos. It makes the definition of unfoldConvStream non-recursive.
> It also adds a new recursive function `self', which won't receive a
> Nullable dictionary as an argument.
> I confirmed that this patch fixes Maciej's problem. Other functions
> from the library may suffer from the same problem, but I haven't
> tested yet. So this patch only modifies unfoldConvStream.
> Regards,
> Takano Akio

More information about the Iteratee mailing list