Message49680
Logged In: YES
user_id=34209
Hmm. Well, adding PyObject_GC_Track() makes GC work right. I
don't know why, since the rest of itertools doesn't use
PyObject_GC_Track, but it now fixes refleaks that involve
just itertools, like:
def leak():
class gen:
def __iter__(self):
return self
def next(self):
return self.item
g = gen()
head, tail = tee(g)
g.item = head
This example leaked without tee doing GC (and without
PyObject_GC_Track), but doesn't leak with proper GC.
However! test_generators still leaks, and so does this
example (which doesn't use itertools):
def leak():
def gen():
while True:
yield g
g = gen()
g.next()
I suspect this leak was introduced after I submitted this
patch, which explains why this patch suddenly stopped
working ;) Since adding GC still fixes reference-cycles, I
will check in this patch while I hunt for the other leak.
|
|
Date |
User |
Action |
Args |
2007-08-23 15:46:42 | admin | link | issue1444398 messages |
2007-08-23 15:46:42 | admin | create | |
|