[Patches] [ python-Patches-1444398 ] Make itertools.tee participate in GC
SourceForge.net
noreply at sourceforge.net
Tue Mar 7 01:52:46 CET 2006
Patches item #1444398, was opened at 2006-03-06 15:33
Message generated for change (Comment added) made by tim_one
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1444398&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Modules
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Thomas Wouters (twouters)
Assigned to: Raymond Hettinger (rhettinger)
Summary: Make itertools.tee participate in GC
Initial Comment:
A small patch to make itertools.tee objects participate
in GC; solves the memoryleak in test_generators (and
any other use of tee objects in cycles.)
----------------------------------------------------------------------
>Comment By: Tim Peters (tim_one)
Date: 2006-03-06 19:52
Message:
Logged In: YES
user_id=31435
If there are likely to be millions of some type of object,
then avoiding gc for that type on grounds of reducing memory
use may be arguable (or, as in the cases of tuples or lists,
may not be arguable regardless). Else "if it points to a
PyObject, it might be in a cycle, so gc-enable it" generally
rules.
I'll note in passing that the m235 and fib generators
weren't _intended_ to stress Python in any way, but have
been extremely effective at doing so since generators first
went in. Think of them as a pair of canaries in the coal
mine :-)
----------------------------------------------------------------------
Comment By: Thomas Wouters (twouters)
Date: 2006-03-06 19:12
Message:
Logged In: YES
user_id=34209
Well, I'm fine with removing the scope-enclosed generator
versions of _m235() and fib() from test_generators, if
that's what you're implying. :> However, I think it's
slightly more suitable to just have tee participate in GC.
----------------------------------------------------------------------
Comment By: Raymond Hettinger (rhettinger)
Date: 2006-03-06 19:05
Message:
Logged In: YES
user_id=80475
I will take a look at the patch soon. IIRC, there was a
concious decision to not have tee engage in GC because no
normal use cases created cycles (they seem to arise only
when intentionally creating a cycle for test code).
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1444398&group_id=5470
More information about the Patches
mailing list