iteratee [Haskell] ANN: -0.7.0.2 and 0.8.0.1 released

John Lato jwlato at gmail.com
Tue Feb 15 16:50:18 GMT 2011


Hi Jason,

(cc'd to iteratee at projects.haskell.org)

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.

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.

For now, if anyone needs short-circuiting within iteratee, I would recommend
that you use the iteratee in-built exception handling over an 'IO' or other
non-short-circuiting monad stack.

Best,
John

On Tue, Feb 15, 2011 at 3:03 PM, Jason Dagit <dagitj at gmail.com> wrote:

> Hi John,
>
> Do you describe this memory leak an the fix anywhere?
>
> Thanks!
> Jason
>
> On Thu, Feb 10, 2011 at 2:31 PM, John Lato <jwlato at gmail.com> wrote:
>
>> (Apologies for cross-posting)
>>
>> I have recently discovered a memory leak which affects all current
>> versions of iteratee.  I have released iteratee versions 0.7.0.2 and 0.8.0.1
>> which fixes the memory leak.  I would strongly encourage all users of
>> earlier versions to upgrade to one of these releases.
>>
>> Cheers,
>> John Lato
>>
>> _______________________________________________
>> Haskell mailing list
>> Haskell at haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://projects.haskell.org/pipermail/iteratee/attachments/20110215/0db78a8b/attachment.htm>


More information about the Iteratee mailing list