[Python-Dev] funny leak

Tim Peters tim.one@comcast.net
Mon, 24 Mar 2003 11:10:46 -0500


OK, there's no leaking memory here, but there is a leaking refcount:  the
refcount on the int 0 keeps going up.  The compiler has leaked references to
little integers before, but offhand I don't recall the details.

----- old stuff -----
OK, *this* program leaks a reference each time around; probably a missing
decref in the compiler:

source = """\
def conjoin(gs):
    def gen():
        gs      # unbreakable cycle
        gen     # unless one is commented out
"""

def one():
    exec source in {}

import sys, gc
lastrc = 0
while 1:
    one()
    gc.collect()
    thisrc = sys.gettotalrefcount()
    print thisrc - lastrc,
    lastrc = thisrc