<br><div><span class="gmail_quote">On 3/27/06, <b class="gmail_sendername">Raymond Hettinger</b> &lt;<a href="mailto:raymond.hettinger@verizon.net">raymond.hettinger@verizon.net</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
&gt; Modified:<br>&gt;&nbsp;&nbsp; python/trunk/Modules/itertoolsmodule.c<br>&gt; Log:<br>&gt;<br>&gt; Make itertools.tee and its internal teedataobject participate in GC. This<br>&gt; alone does not solve the leak in test_generators, unfortunately, but it is
<br>&gt; part of test_generators' problem and it does solve other cycles.<br><br>Thanks for getting this in.<br><br>To get the leak in test_generators, I think you make need to add GC to the<br>teeobject as well as the teedataobject.
</blockquote><div><br>The teeobject has GC (hence the word 'and' in 'itertools.tee and its internal teedataobject' ;-) The problem with test_generators is that this also leaks:<br><br>def leak():<br>&nbsp;&nbsp;&nbsp; def gen():<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while True:
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; yield g<br>&nbsp;&nbsp;&nbsp; g = gen()<br><br>leak()<br><br>It doesn't leak in 2.4. I'm using a little shell script to work backwards through the 2.5 changes to find out which one introduced this, although I somehow suspect it's the coroutine stuff... ;P
<br><br></div></div>-- <br>Thomas Wouters &lt;<a href="mailto:thomas@python.org">thomas@python.org</a>&gt;<br><br>Hi! I'm a .signature virus! copy me into your .signature file to help me spread!