[Haskell-cafe] Space leak with recursion

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

On Fri, Apr 24, 2015 at 11:34:25AM +0200, Martijn Rijkeboer wrote:
> >> Once thee space leak is fixed I will need to add code to increment the
> >> sequence number (not yet implemented).
> >
> > In that case the most important thing to do is to try to reproduce the
> > space leak without the snapshot socket.
> I've just ran the code below (removed the snapshot socket) and the
> space leak is still there. Since I don't have access to a Windows
> box at the moment this was tested on the following configuration:
> - OS: Ubuntu 14.04 (64-bit)
> - GHC: 7.8.4 (64-bit)
> - Zeromq4-haskell: 0.6.3  (Stackage LTS 2.4)
> - ZeroMQ: 4.0.4 (64-bit)

This behaviour is consistent with my understanding of how `poll` behaves. 
`poll` has trivial work to do when the handler returns, and recording this
work consumes space that won't be freed.

Avoid calling `pollSockets` in your handlers and you'll be fine.


More information about the Haskell-Cafe mailing list