pydoc memory leak

Neil Schemenauer nas at python.ca
Fri Jun 22 17:35:57 CEST 2001


I bet pydoc is creating reference cycles that are not being
cleaned up by the GC.  The GC currently does not track frame
objects.  If you get a frame object and assign it to a local
variable you are probably creating a reference cycle.  Here's
some sample code that leaks memory:

    import sys
    def a():
        return sys._getframe()

    def b():
        frame = a() # Oops, reference cycle!
        #del frame # this would break the cycle

    while 1:
        b()


HTH,

  Neil




More information about the Python-list mailing list