[Python-Dev] reference leaks, __del__, and annotations

Thomas Wouters thomas at python.org
Sat Apr 1 12:06:38 CEST 2006


On 4/1/06, Nick Coghlan <ncoghlan at 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 at python.org>

Hi! I'm a .signature virus! copy me into your .signature file to help me
spread!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-dev/attachments/20060401/903cf1d2/attachment.html 


More information about the Python-Dev mailing list