Setting _callback and _args to None in Handle.cancel() sounds fair, but I don't understand how you get a reference cycle. Handle objects are private, how did you such cycle?
Victor 2014-07-04 0:25 GMT+02:00 chrysn <[email protected]>: > hi, > > i've just spent some time debugging what looked like reference cycles, > only to find out that timeouts keep their callbacks around even if they > are cancelled, and the cancelled timers don't get consumed until all > earlier timeouts fired or got cancelled. > > my suggestion is for the asyncio.events.TimerHandle (probably also the > generic .Handle) to set their ._callback and ._args to None when they > are cancelled. this would help keeping the memory free, and would ease > debugging of kept-around references. > > is there any reason why this should not done? if not, please consider > adding `self._callback = self._args = None` to > asyncio.events.Handle.cancel. > > best regards > chrysn > > -- > To use raw power is to make yourself infinitely vulnerable to greater powers. > -- Bene Gesserit axiom
