• Jeremy Hylton's avatar
    Fix memory leak involving persistent objects and caches. · e5567b6e
    Jeremy Hylton authored
    Problem reported by Ulla Theiss and diagnosed by Shane Hathaway.  The
    long and short of it is that persistent objects refer to their
    connection which refers to its cache which refers to the persistent
    objects.  We can't let GC find the cycle because persistent objects
    are extension class objects, and, thus, don't participate in GC.
    
    Add an explicit clear() method that removes non-ghost objects from the
    ring without going to all the trouble of ghosting them.  At some
    point, they'll just get deallocated (which will ghostify them).
    
    A cleared cache has non-ghost objects in the dict that are not in the
    ring, so we need to add some checks for whether the object is actually
    in the ring.
    e5567b6e
cPickleCache.c 27.7 KB