pub fn gc_state() -> &'static GcStateExpand description
Get a reference to the GC state.
In threading mode this is a true global (OnceLock). In non-threading mode this is thread-local, because PyRwLock/PyMutex use Cell-based locks that are not Sync.
Every interpreter’s tracked objects live in these lists, because untracking
happens in default_dealloc, where no interpreter is in scope to route to.
What a collection acts on is still one interpreter’s own objects, selected
by the gc_owner tag; GcInterpreterState holds the rest of the state
that goes with that. The counts here, and so gc.get_count() and
gc.get_freeze_count(), stay process-wide: they measure how full these
lists are.