FreeMemory

Legacy Wiki Page

This page was migrated from the old MoinMoin-based wiki. Information may be outdated or no longer applicable. For current documentation, see python.org.

As Christian Heimes describes it here, Python uses its own memory allocator for small objects (< 257 bytes). Larger objects are allocated directly with malloc, smaller objects end up in arenas. The code is well documented in obmalloc.c.

  • Classes with a [del] method may create reference cycles. The GC can’t break cycles when a [del] method is involved.

  • keeping references to tracebacks, exception objects (except Exception, err) or frames (sys._getframe())

Related information: