[issue30150] raw debug allocators to not return malloc alignment

STINNER Victor report at bugs.python.org
Tue Apr 25 05:05:45 EDT 2017


STINNER Victor added the comment:

> On for example x32 malloc returns 16 byte aligned memory but size_t is 4 bytes.

x32 is a strange platform :-( Does numpy support it? I'm not sure that Python works on such platform.

I suggest to hardcode 16 or 32 bytes in _PyMem_DebugRawAlloc instead of relying on sizeof(size_t). pymalloc aligns memory allocations to 8 bytes if I recall correctly.


> How it cause problem?

numpy uses SIMD instructions which require strict memory alignement.

Note: There was also an issue #18835 to "Add aligned memory variants to the suite of PyMem functions/macros", but it was rejected.

----------
nosy: +haypo

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30150>
_______________________________________


More information about the Python-bugs-list mailing list