[Stackless] weak reference on tempval?
Péter Szabó
ptspts+stackless at gmail.com
Thu May 6 01:06:34 CEST 2010
FYI There is indeed a memory leak on a circular reference.
import gc
import resource
import stackless
import weakref
gc.disable()
resource.setrlimit(resource.RLIMIT_AS, (200 << 20, 200 << 20)) # 200 MB
while True:
t = stackless.tasklet(stackless.schedule)()
assert t.alive
stackless.schedule()
assert t.alive
assert t is t.tempval # Circular reference: t --> t.tempval --> t
t.remove()
Solution to avoid using unnecessary memory: always call
stackless.schedule(None) instead of stackless.schedule(); also for
stackless.schedule_remove().
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stackless.com/pipermail/stackless/attachments/20100506/30715785/attachment.htm>
More information about the Stackless
mailing list