Garbage collection problem with generators
rosuav at gmail.com
Wed Dec 28 08:11:59 EST 2016
On Wed, Dec 28, 2016 at 9:03 PM, Haochuan Guo <guohaochuan at gmail.com> wrote:
> Anyone? The script to reproduce this problem is in:
> On Fri, Dec 23, 2016 at 8:39 PM Haochuan Guo <guohaochuan at gmail.com> wrote:
>> This is reproducible with python2.7, but not in python3.5. I've also tried
>> with `thread` instead of `gevent`, it still happens. I'm guessing it's
>> related to garbage collection of generators.
>> Did I bump into a python2 bug? Or am I simply wrong about the way to close
(Please don't top-post.)
Maybe the fix is to just use Python 3.5+? :) It probably is to do with
the garbage collection of generators; so you may want to consider
using something very explicit (eg a context manager) to ensure that
you call gen.close().
More information about the Python-list