[Stackless] weak reference on tempval?

Kristján Valur Jónsson kristjan at ccpgames.com
Thu May 6 13:34:13 CEST 2010

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?

From: stackless-bounces at stackless.com [mailto:stackless-bounces at stackless.com] 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
resource.setrlimit(resource.RLIMIT_AS, (200 << 20, 200 << 20))  # 200 MB
while True:
  t = stackless.tasklet(stackless.schedule)()
  assert t.alive
  assert t.alive
  assert t is t.tempval  # Circular reference: t --> t.tempval --> t

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/2fe71b4a/attachment.html>

More information about the Stackless mailing list