On 4/1/06, Nick Coghlan <ncoghlan@gmail.com> wrote:
Greg Ewing wrote:
> I find it rather worrying that there could be a
> few rare cases in which my generators cause
> memory leaks, through no fault of my own and
> without my being able to do anything about it.

The GC changes PJE is looking at are to make sure you *can* do something about
it. If the generator hasn't been started, or has already finished, then the GC
won't consider it as needing finalisation.

Actually, if a generator has already finished, it no longer holds a suspended frame alive, and there is no cycle (at least not through the generator.) That's why test_generators no longer leaks; explicitly closing the generator breaks the cycle. So the only thing fixing GC would add is cleaning up cycles where a created but not started generator is the only thing keeping the cycle alive.

--
Thomas Wouters <thomas@python.org>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!