C API's 3 Core Functions for Manual Memory Control

`Py_INCREF`, `Py_DECREF`, and `PyMem_Malloc` are the primary C API functions that allow extensions to directly manage object lifetimes and memory allocation/deallocation, enabling manual cycle freedom and bypassing Python's automatic garbage collection for granular performance control.

Sources

Open the full topic