[issue18835] Add aligned memory variants to the suite of PyMem functions/macros

Nathaniel Smith report at bugs.python.org
Fri Dec 5 23:43:08 CET 2014


Nathaniel Smith added the comment:

Re: msg232219: If you go down the route of adding both aligned_malloc and aligned_free to the Allocator structure, I think you might as well support it for all domains? For the PyMem and PyObject domains you can just literally set the default functions to be PyMem_RawAlignedMalloc and PyMem_RawAlignedFree, and that leaves the door open to fancier implementations in the future (e.g. if PyMalloc starts implementing aligned allocation directly).

Re: msg232222: Currently all the domains share the same vtable struct, though, whereas aligned allocator functions have different signatures. So you can't literally just add an entry to the existing domain enum and be done.

It also occurs to me that if numpy ever gets serious about using aligned memory then we might also need aligned_realloc (numpy allows arrays to be resized, sigh), which is possible to do but I *cannot* recommend python attempt to provide as a standard interface. (It's not available at all in POSIX.) I guess this is another argument that it might be best to just give numpy an escape valve and worry about CPython's internal needs separately.

----------

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


More information about the Python-bugs-list mailing list