Antoine Pitrou <pit...@free.fr> added the comment:

Le mardi 10 février 2009 à 21:18 +0000, Antoine Pitrou a écrit :
> Note: a 64-bit build shows an even greater allocation unit:
> 
> >>> class C(object):
> ...    __slots__ = ('x')
> ... 
> >>> l = [C() for i in range(20)]
> >>> [id(l[i+1]) - id(l[i]) for i in range(len(l)-1)]
> [56, -112, 168, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
> 56, 56]
> 
> I wonder why the allocation unit is 56 and not 48 (2*24).

I have found the answer. The PyGC_Head forces its own alignment using a
"long double" dummy, which in 64-bit mode (Linux / gcc) wastes 8 bytes
between the end of the PyGC_Head and the PyObject itself.
(SIZEOF_LONG_DOUBLE is 16 in pyconfig.h)

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue5186>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to