Fix a major memory leak when using the libevent or libev hubs. Timers were not being removed from the hub after they fired. (Thanks Agusto Becciu).
This commit is contained in:
2
NEWS
2
NEWS
@@ -5,6 +5,8 @@ Fixes some long-standing bugs where sometimes failures in accept() or connect()
|
||||
|
||||
0.6.1: Added eventlet.tpool.killall. Blocks until all of the threadpool threads have been told to exit and join()ed. Meant to be used to clean up the threadpool on exit or if calling execv. Used by Spawning.
|
||||
|
||||
0.6.2: Fix a major memory leak when using the libevent or libev hubs. Timers were not being removed from the hub after they fired. (Thanks Agusto Becciu).
|
||||
|
||||
0.5.x
|
||||
=====
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ class Timer(object):
|
||||
This timer will not be run unless it is scheduled in a runloop by
|
||||
calling timer.schedule() or runloop.add_timer(timer).
|
||||
"""
|
||||
self.impltimer = None
|
||||
self.cancelled = False
|
||||
self.seconds = seconds
|
||||
self.tpl = cb, args, kw
|
||||
@@ -72,6 +73,9 @@ class Timer(object):
|
||||
def __call__(self, *args):
|
||||
if not self.called:
|
||||
self.called = True
|
||||
if self.impltimer is not None:
|
||||
del get_hub().timers_by_greenlet[self.greenlet][self]
|
||||
|
||||
cb, args, kw = self.tpl
|
||||
cb(*args, **kw)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user