This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients jcea, mark.dickinson, pitrou, rhettinger
Date 2009-02-10.21:46:28
SpamBayes Score 0.00024740945
Marked as misclassified No
Message-id <1234302425.7395.5.camel@fsol>
In-reply-to <1234300713.05.0.597496618391.issue5186@psf.upfronthosting.co.za>
Content
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)
History
Date User Action Args
2009-02-10 21:46:29pitrousetrecipients: + pitrou, rhettinger, jcea, mark.dickinson
2009-02-10 21:46:28pitroulinkissue5186 messages
2009-02-10 21:46:28pitroucreate