[Stackless] Memory leak with Stackless and generators
Jeff Senn
senn at maya.com
Wed Dec 20 21:06:49 CET 2006
On Dec 20, 2006, at 1:42 PM, Carlos Eduardo de Paula wrote:
> This happens here too. Using Windows XP SP2..
On OS-X as well...(in stackless 2.5 but not in 2.4.3)
<sigh> I hate the complexity of Python's internal generator code these
days... it looks like frames and cframes are being constantly generated.
Here, this demonstrates the leak for anyone who feels like pursuing
immediately.
Notice frames/cframe accrue and never go away.
---------------------------
def foo():
yield 1
import gc
check = []
while 1:
gc.collect(2)
before = gc.get_objects()
for i in foo():
pass
gc.collect(2)
after = gc.get_objects()
print len(before),len(after)
for x in check:
if x not in after:
print "this never prints out so these objects are around
forever"
break
for x in after:
if x is not before and x is not after and x not in before:
print "NEW THING",repr(x)[:40]
check.append(x)
_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless
More information about the Stackless
mailing list