Author vstinner
Recipients benjamin.peterson, neologix, njs, pitrou, rhettinger, skrah, tim.peters, trent, vstinner, wscullin, xdegaye
Date 2017-11-02.11:40:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1509622859.69.0.213398074469.issue18835@psf.upfronthosting.co.za>
In-reply-to
Content
About the API itself, I'm not sure that PyMem_AlignedAlloc(alignment, size) is flexible enough. If we want to get *data* aligned in a Python object, we would have to pass an offset to the data, since Python objects have headers of variable size (depending on the type).

Windows has such API:

void * _aligned_offset_malloc(  
   size_t size,   
   size_t alignment,   
   size_t offset  
);  

This function is based on malloc, so likely adds padding bytes for you depending on size, alignment and offset.

https://msdn.microsoft.com/fr-fr/library/ec852tkw.aspx

See bpo-27987: "obmalloc's 8-byte alignment causes undefined behavior".
History
Date User Action Args
2017-11-02 11:40:59vstinnersetrecipients: + vstinner, tim.peters, rhettinger, pitrou, benjamin.peterson, trent, njs, skrah, neologix, xdegaye, wscullin
2017-11-02 11:40:59vstinnersetmessageid: <1509622859.69.0.213398074469.issue18835@psf.upfronthosting.co.za>
2017-11-02 11:40:59vstinnerlinkissue18835 messages
2017-11-02 11:40:59vstinnercreate