[Python-Dev] A "new" kind of leak
Sun, 14 Apr 2002 15:50:31 -0400
> PyCFunctionObject and PyMethodObject also use free lists and set the GC
I haven't yet been able to provoke unbounded process growth using these,
although I confess I haven't dedicated my life to it <wink>. The usual
outcome is that creating one of these guys also involves creating another
kind of gc'ed object (like a class instance) that doesn't use a free list,
and that's also involved in the cycle, and then the allocations of that
latter kind of object trigger gc regularly.
self.f = self.f # create a loop
That creates tons of cycles, but every 1000-or-so times around the loop, the
excess of instance objects allocated triggers gc into cleaning them all up.
That prevents the bound method object free list from growing more than
1000-or-so entries too.