[Haskell-cafe] Space leak with recursion

Martijn Rijkeboer haskell at bunix.org
Fri Apr 24 09:39:23 UTC 2015

> In fact I think we can already deduce the answer from the
> implementation of `poll`:
>     http://hackage.haskell.org/package/zeromq4-haskell-0.6.3/docs/src/System-ZMQ4.html#poll
> The key point is that the [Poll s m] list is `mapM`ed over. Each
> handler is checked for a match and then fired or not fired before the
> next handler is checked for a match.  This means that if you call
> `pollSockets` in a handler you are leaking the space associated with
> the unprocessed entries.

I should have checked the code. Unfortunately the idea to use a
recursive call to pollSockets comes from the Haskell examples in
the ZeroMQ guide. So I will probably not be the only one that has
this issue...

Kind regards,

Martijn Rijkeboer

More information about the Haskell-Cafe mailing list