PATCH: fix alignment in slab.c
Trond Norbye
Trond.Norbye at Sun.COM
Fri Jan 4 12:00:27 UTC 2008
The memory returned from do_slabs_alloc is currently not properly
aligned when compiled in an ILP32 environment. The memory returned is
aligned to the size of the pointers, but we need to return a pointer
that is suitable aligned so that it may be assigned to a pointer to any
type of object.
The cas_id member cause the item-struct to require 8 byte boundaries.
Index: slabs.c
===================================================================
--- slabs.c (revision 689)
+++ slabs.c (working copy)
@@ -25,7 +25,7 @@
#define POWER_SMALLEST 1
#define POWER_LARGEST 200
#define POWER_BLOCK 1048576
-#define CHUNK_ALIGN_BYTES (sizeof(void *))
+#define CHUNK_ALIGN_BYTES 8
#define DONT_PREALLOC_SLABS
/* powers-of-N allocation structures */
--------------END------------
--
Trond Norbye
More information about the memcached
mailing list