[Python-Dev] reference leaks, __del__, and annotations

Tim Peters tim.peters at gmail.com
Mon Apr 3 22:02:06 CEST 2006


[Guido]
>>> but don't we have a whole word of GC-related flags?

[Neil S]
>> No.

[James Y Knight]
> Actually there is. Kinda. Currently python's refcounting scheme uses
> 4 words per object (gc_next, gc_prev, gc_refs, ob_refcnt), and has
> one spare word in the padding of PyGC_Head that's just sitting there
> wasting memory.

Using which compiler?  This varies across boxes.  Most obviously, on a
64-bit box all these members are 8 bytes (note that ob_refcnt is
Py_ssize_t in 2.5, not int anymore), but even on some 32-bit boxes the
"long double" trick only forces 4-byte alignment.


More information about the Python-Dev mailing list