helun/Ektorp — pull request #117 by pimterry (2013-04-29 21:52:22+00:00)
Title: Fix memory leak in idle connection monitor

Currently the idle connection monitor keeps trying to close expired connections on all opened connection managers ever, forever. In any application where you build an arbitrary number of connection from external input this leaks memory, and actually quite a lot, since this also holds on to the whole connection pool of connections and their connection buffers etc for each of the connections held here.

This fixes that by holding connection managers with weak references instead, and then having the cleanup tasks cancel themselves if the connection manager has been GC'd (i.e. if the connection manager was the only thing left holding it).

This builds on top of my other pull request (#116), so that'll need merging first.