[3.7] bpo-27987: align PyGC_Head to alignof(long double) (GH-13335) by methane · Pull Request #13581 · python/cpython (original) (raw)
What I'm missing is why this is even necessary at this point given the obmalloc alignment change? What does this change actually cause to happen?
Alignment is all or nothing. If this is not aligned, no need to align pointer returned by obmalloc.
See this figure.
#13318 make pointer PyObject_Malloc returned (a) aligned to 16 byte. Now PyGC_Head *gc
is aligned to 16 byte.
This pull request make sizeof(PyGC_Head) (b) aligned to 16 byte. Now PyObject *o = (PyObject*)(gc+1)
is aligned to 16 byte.
C compiler align (c) part automatically. Now member of PyObject is aligned.