CPython Memory Management Facts

Select all statements that are true about CPython's memory management. (Select all that apply.)

A. del x decrements the reference count of the object x was bound to by exactly one; it does not necessarily reduce that count to zero.

B. id() is guaranteed by the Python language specification to return the object's address in memory.

C. A reference cycle with no external references will eventually be freed by CPython even if gc.collect() is never called explicitly, because the cyclic garbage collector normally runs automatically alongside reference counting.

D. Every Python implementation, including PyPy, uses reference counting as its primary memory management strategy, so is-based identity checks on cached small integers behave identically across implementations.

A

D. Every implementation, including PyPy, uses reference counting, so small-int identity checks are portable.

B

A. del x decrements the target's reference count by exactly one, without necessarily reaching zero.

C

B. id() is guaranteed by the language specification to return a memory address.

D

C. An unreachable reference cycle is eventually freed automatically by CPython's cyclic GC, without an explicit gc.collect() call.