On 8 March 2014 23:01, Victor Stinner <victor.stin...@gmail.com> wrote: > 2014-03-08 12:45 GMT+01:00 Antoine Pitrou <solip...@pitrou.net>: >>> Attached script: never_deleted2.py, it's almost the same but it >>> explains better the problem. The script creates MyObject and Future >>> objects which are never deleted. Calling gc.collect() does *not* break >>> the reference cycle (between the future, the exception, traceback and >>> frames). Stopping the event loop does not remove Future nor MyObject >>> objects. Only exiting Python does remove the Future object. >> >> So clearly the coroutine must be kept alive by something. > > It's a reference cycle. Something like that: > > Future -> Exception -> Traceback -> Frames -> Local variables -> > {Future, MyObject}
It seems unlikely we could have an uncollectable reference cycle that doesn't end up in gc.garbage. Are you sure there are no external references to one of the objects in the cycle, thus keeping the whole thing alive? Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com