iteratee [Haskell] ANN: - and released

Jason Dagit dagitj at
Tue Feb 15 17:15:14 GMT 2011

On Tue, Feb 15, 2011 at 8:50 AM, John Lato <jwlato at> wrote:

> Hi Jason,
> (cc'd to iteratee at
> No, I didn't.  When I discovered it I intended to write a bug report in the
> Trac instance, but the community server was still having problems so I
> couldn't.  I'll try again tonight, but until then here's a quick description
> of the memory leak fixed in the most recent point release.
> The functions "enumHandle", "enumFd", and variants suffered from a memory
> leak.  They allocated a temporary buffer with 'malloc' that was never
> free'd.  The current solution uses a combination of
> "Control.MonadCatchIO.bracket" and "free" to ensure the memory is released.

Oh, I see.  That is problematic.

> Unfortunately this suffers from the short-circuiting monad bug in
> MonadCatchIO.  If an iteratee is used with a short-circuiting monad (e.g.
> ErrorT), the memory can still fail to be released.
> A better solution would be to use "alloca" or a ForeignPtr to obtain and
> release the memory automatically, however this will require switching from
> MonadCatchIO.  I'm likely to make this switch with the next major release,
> however I thought it best to provide a point release that fixes the most
> common cases in the interim.

Thank you for doing that stop-gap point release.  It's very considerate to
users of your library.  I wish more libraries thought that far ahead :)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Iteratee mailing list