[Haskell-cafe] Space leak with recursion

Tom Ellis tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Fri Apr 24 09:59:05 UTC 2015


On Fri, Apr 24, 2015 at 11:53:50AM +0200, Martijn Rijkeboer wrote:
> > On Fri, Apr 24, 2015 at 11:43:44AM +0200, Martijn Rijkeboer wrote:
> >> >> 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...
> >> >
> >> > Strange.  Can you link me to that?
> >>
> >> An example that uses the pollSockets idea (pollServer):
> >> -
> >> https://github.com/imatix/zguide/blob/master/examples/Haskell/lpclient.hs
> >
> > That's quite different.  `sendServer` is not being called by `poll`.
> 
> Maybe I don't understand, but inside the pollServer function a call to
> poll is done and on line 47 and 56 of that same function, pollServer is
> called again (recursive).

It's fine to call `pollServer` recursively, but it's not fine to call it
recursively from a handler, i.e. something that occurs in the second
argument to `poll`.

Tom


More information about the Haskell-Cafe mailing list