Interesting.
I must confess that I never understood the point of the argument to 
stackless.schedule().  What's the point of putting anything in there at all?
Might we just not deprecate it, or remove the feature?
K

From: [email protected] [mailto:[email protected]] 
On Behalf Of Péter Szabó
Sent: 5. maí 2010 23:07
To: The Stackless Python Mailing List
Subject: Re: [Stackless] weak reference on tempval?

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().
_______________________________________________
Stackless mailing list
[email protected]
http://www.stackless.com/mailman/listinfo/stackless

Reply via email to