diff --git a/src/object.cpp b/src/object.cpp index 77fc1c732..7d07d2de4 100644 --- a/src/object.cpp +++ b/src/object.cpp @@ -127,9 +127,10 @@ robj *createEmbeddedStringObject(const char *ptr, size_t len) { * OBJ_ENCODING_EMBSTR_SIZE_LIMIT, otherwise the RAW encoding is * used. * - * The current limit of 44 is chosen so that the biggest string object + * The current limit of 52 is chosen so that the biggest string object * we allocate as EMBSTR will still fit into the 64 byte arena of jemalloc. */ -#define OBJ_ENCODING_EMBSTR_SIZE_LIMIT 44 +#define OBJ_ENCODING_EMBSTR_SIZE_LIMIT 48 +static_assert((sizeof(redisObject)+OBJ_ENCODING_EMBSTR_SIZE_LIMIT-8) == 64, "Max EMBSTR obj should be 64 bytes total"); robj *createStringObject(const char *ptr, size_t len) { if (len <= OBJ_ENCODING_EMBSTR_SIZE_LIMIT) return createEmbeddedStringObject(ptr,len); diff --git a/src/storage.h b/src/storage.h index 5aee09817..e9106aca2 100644 --- a/src/storage.h +++ b/src/storage.h @@ -1,7 +1,7 @@ #ifndef __STORAGE_H__ #define __STORAGE_H__ -#define OBJ_ENCODING_EMBSTR_SIZE_LIMIT 44 // Note: also defined in object.c - should always match +#define OBJ_ENCODING_EMBSTR_SIZE_LIMIT 48 // Note: also defined in object.c - should always match #ifdef __cplusplus extern "C" {