[New-bugs-announce] [issue30150] raw debug allocators to not return malloc alignment

Julian Taylor report at bugs.python.org
Sun Apr 23 18:01:08 EDT 2017


New submission from Julian Taylor:

The debug raw allocator do not return the same alignment as malloc. See  _PyMem_DebugRawAlloc:
https://github.com/python/cpython/blob/master/Objects/obmalloc.c#L1873

The line
return p + 2*SST

adds 2 * sizeof(size_t) to the pointer returned by malloc.
On for example x32 malloc returns 16 byte aligned memory but size_t is 4 bytes.
This makes all memory returned by the debug allocators not aligned the what the system assumes on such platforms.

----------
components: Interpreter Core
messages: 292187
nosy: jtaylor
priority: normal
severity: normal
status: open
title: raw debug allocators to not return malloc alignment
versions: Python 2.7, Python 3.6, Python 3.7

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


More information about the New-bugs-announce mailing list