summaryrefslogtreecommitdiff
path: root/src/object.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2014-05-07 17:05:09 +0200
committerantirez <antirez@gmail.com>2014-05-07 17:05:09 +0200
commit0b0f872f3f1536e30b2fab0b4297ea960d8247e1 (patch)
treecbb79622df792569cdaa282117d5e4a0fef4fd6b /src/object.c
parent76c31d425e797ddf5daedd29d893d3fc9c7cfc19 (diff)
downloadredis-0b0f872f3f1536e30b2fab0b4297ea960d8247e1.tar.gz
REDIS_ENCODING_EMBSTR_SIZE_LIMIT set to 39.
The new value is the limit for the robj + SDS header + string + null-term to stay inside the 64 bytes Jemalloc arena in 64 bits systems.
Diffstat (limited to 'src/object.c')
-rw-r--r--src/object.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/object.c b/src/object.c
index 5602b688e..46f1f3f8b 100644
--- a/src/object.c
+++ b/src/object.c
@@ -76,8 +76,11 @@ robj *createEmbeddedStringObject(char *ptr, size_t len) {
/* Create a string object with EMBSTR encoding if it is smaller than
* REIDS_ENCODING_EMBSTR_SIZE_LIMIT, otherwise the RAW encoding is
- * used. */
-#define REDIS_ENCODING_EMBSTR_SIZE_LIMIT 32
+ * used.
+ *
+ * The current limit of 39 is chosen so that the biggest string object
+ * we allocate as EMBSTR will still fit into the 64 byte arena of jemalloc. */
+#define REDIS_ENCODING_EMBSTR_SIZE_LIMIT 39
robj *createStringObject(char *ptr, size_t len) {
if (len <= REDIS_ENCODING_EMBSTR_SIZE_LIMIT)
return createEmbeddedStringObject(ptr,len);