Re: [Python-Dev] [Python-checkins] Python Regression Test Failures refleak (1)
On 3/5/06, Neal Norwitz
test_generators leaked [255, 255, 255] references
254 of those 255 leaks seem to be caused by the two recursive-generator
examples at the bottom of the fun_tests doctest: fib() and the last m235()
implementation. The recursiveness isn't in the generators themselves, but
rather in the use of their own return values through a nested scope -- the
cell objects for those values hold tee-iterators which hold (through a
tee-dataobject) a reference to the generator. It doesn't look like
tee-objects participate in GC, so there's no way to break the cycle. I added
a quick 'close' implementation to itertools.tee, which just calls the
'close' method of whatever iterator it is tee'ing, and that does solve the
issue. Considering the fairly convoluted use of generators, I guess the
latter solution is acceptable (although it would be nice if tee objects did
do GC, at least enough so to let the GC do its work. I haven't looked at
howmuch effort that would take.)
The last leak is somewhere in the coroutines_tests doctest, but I haven't
taken the time to figure out where, exactly.
--
Thomas Wouters
participants (1)
-
Thomas Wouters