CPython's Garbage Collector: Generational Collection at Work
CPython frees most objects the instant their refcount hits zero; the cyclic GC is the safety net for reference cycles, using three generations and a gc_ref copy of the refcount.
CPython frees most objects the instant their refcount hits zero; the cyclic GC is the safety net for reference cycles, using three generations and a gc_ref copy of the refcount.
Python 3.15 makes startup cheaper, UTF-8 the default, and ships a sampling profiler you can attach to a running process.
Every int from -5 to 1024 is allocated once at startup and marked immortal, so a = 1; b = 1; a is b is True by construction — not by accident of the language.
Freelists turn the first word of a dead object into a linked-list pointer, so the next list, tuple, or float pops a ready-made shell instead of hitting the allocator.
Vectorcall replaces the per-call tuple and dict with a plain C array plus a kwnames tuple, and the ARGUMENTS_OFFSET flag makes bound methods allocation-free.