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_LARGEST  200
 #define POWER_BLOCK 1048576
-#define CHUNK_ALIGN_BYTES (sizeof(void *))
 /* powers-of-N allocation structures */

Trond Norbye

More information about the memcached mailing list