[Neil Schemenauer] > PyCFunctionObject and PyMethodObject also use free lists and set the GC > flag. 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. For example, import gc gc.set_debug(gc.DEBUG_STATS) class C: def f(self): self.f = self.f # create a loop while 1: C().f() 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.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4