Author rhettinger
Recipients rhettinger
Date 2013-08-26.02:32:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Currently, we have little to no control over the alignment of memory returned by the PyMem functions.   

I suggest variants such as PyMem_Alloc32(n) and PyMem_Alloc64(n) to return suitably aligned data blocks.

GNU C provides memalign() for this purpose:
and the Microsoft C compiler has _aligned_malloc() for the same purpose:

A principal use case would be PyObject pointers where we want to keep all or most of the data fields in the same cache line (i.e. the fields for list, tuple, dict, and set objects).

Deques would benefit from having the deque blocks aligned to 64byte boundaries and never crossing page boundaries.  Set entries would benefit from 32byte alignment.
Date User Action Args
2013-08-26 02:32:51rhettingersetrecipients: + rhettinger
2013-08-26 02:32:51rhettingersetmessageid: <>
2013-08-26 02:32:51rhettingerlinkissue18835 messages
2013-08-26 02:32:50rhettingercreate