Skip to content
UPEEC

Memory Management

Every value is a heap object; names are references, and memory is reclaimed automatically.

Intermediate
Comments 0

CPython allocates objects on a private heap with its own allocator (pymalloc) for small objects. Reference counting frees most objects immediately; a cycle collector cleans up reference cycles. Tools: sys.getsizeof, tracemalloc, memray.

Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.

Discussion (0)

Sign in or join free to ask questions and discuss this topic.