Python manages memory automatically using two mechanisms: reference counting (the primary method) plus a cyclic garbage collector that handles reference cycles. You never manually free memory, but understanding how it works explains memory behavior and leaks.
Reference counting — the primary mechanism
sys
x = [, , ]
y = x
sys.getrefcount(x)
y
x
