bpo-27987: pymalloc: align by 16bytes on 64bit platform (GH-12850)
(cherry picked from commit f0be4bbb9b3cee876249c23f2ae6f38f43fa7495)
Co-authored-by: Inada Naoki <songofacandy@gmail.com>
diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c
index 46e8427..885ad53 100644
--- a/Objects/obmalloc.c
+++ b/Objects/obmalloc.c
@@ -788,8 +788,14 @@
*
* You shouldn't change this unless you know what you are doing.
*/
+
+#if SIZEOF_VOID_P > 4
+#define ALIGNMENT 16 /* must be 2^N */
+#define ALIGNMENT_SHIFT 4
+#else
#define ALIGNMENT 8 /* must be 2^N */
#define ALIGNMENT_SHIFT 3
+#endif
/* Return the number of bytes in size class I, as a uint. */
#define INDEX2SIZE(I) (((uint)(I) + 1) << ALIGNMENT_SHIFT)