Message81606
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) |
|
Date |
User |
Action |
Args |
2009-02-10 21:46:29 | pitrou | set | recipients:
+ pitrou, rhettinger, jcea, mark.dickinson |
2009-02-10 21:46:28 | pitrou | link | issue5186 messages |
2009-02-10 21:46:28 | pitrou | create | |
|