On Apr 16, 2014, at 5:20 AM, Jonathan Slenders <[email protected]> wrote:
> Just a thought... if in the event loop we would use weakrefs for sockets. Do > we ever have to handle CancelledError? > Would the socket automatically be closed by the garbage collector if there is > no reference anymore to the transport, and because of that also no reference > to the socket anymore? Relying on this is a recipe for disaster. It's a great way to get mysterious unbounded resource leaks, mysterious GC-preventing circular references, and crashes when you run out of file descriptors. All of this is two or three times as bad if you care about running on PyPy, where garbage collection semantics mean files may not be closed for much longer if there isn't a lot of memory pressure. -glyph
