From 9dad9f6ef4f79bc7dffabedfa15b766cfe83ebc7 Mon Sep 17 00:00:00 2001 From: John Sully Date: Sun, 6 Mar 2022 20:38:00 -0500 Subject: [PATCH] Fix MALLOC=memkind build issues --- runtest-moduleapi | 1 + src/object.cpp | 2 +- src/storage.cpp | 1 + src/zmalloc.cpp | 2 +- tests/modules/Makefile | 1 + 5 files changed, 5 insertions(+), 2 deletions(-) diff --git a/runtest-moduleapi b/runtest-moduleapi index 8adf2171d..05ca161ab 100755 --- a/runtest-moduleapi +++ b/runtest-moduleapi @@ -32,6 +32,7 @@ $TCLSH tests/test_helper.tcl \ --single unit/moduleapi/blockedclient \ --single unit/moduleapi/moduleloadsave \ --single unit/moduleapi/getkeys \ +--single unit/moduleapi/timers \ --single unit/moduleapi/test_lazyfree \ --single unit/moduleapi/defrag \ --single unit/moduleapi/hash \ diff --git a/src/object.cpp b/src/object.cpp index 4f38b1768..eb8118d11 100644 --- a/src/object.cpp +++ b/src/object.cpp @@ -138,7 +138,7 @@ robj *createEmbeddedStringObject(const char *ptr, size_t len) { * * 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 52 +size_t OBJ_ENCODING_EMBSTR_SIZE_LIMIT = 52; robj *createStringObject(const char *ptr, size_t len) { if (len <= OBJ_ENCODING_EMBSTR_SIZE_LIMIT) diff --git a/src/storage.cpp b/src/storage.cpp index f36c5474e..6a42b509f 100644 --- a/src/storage.cpp +++ b/src/storage.cpp @@ -118,6 +118,7 @@ void pool_free(struct alloc_pool *ppool, void *pv) return; } +extern size_t OBJ_ENCODING_EMBSTR_SIZE_LIMIT; #define EMBSTR_ROBJ_SIZE (sizeof(robj)+sizeof(struct sdshdr8)+OBJ_ENCODING_EMBSTR_SIZE_LIMIT+1) struct alloc_pool poolobj; struct alloc_pool poolembstrobj; diff --git a/src/zmalloc.cpp b/src/zmalloc.cpp index 3e20cc652..dac6f6631 100644 --- a/src/zmalloc.cpp +++ b/src/zmalloc.cpp @@ -243,7 +243,7 @@ void *ztryrealloc_usable(void *ptr, size_t size, size_t *usable) { #else realptr = (char*)ptr-PREFIX_SIZE; oldsize = *((size_t*)realptr); - newptr = realloc(realptr,size+PREFIX_SIZE); + newptr = realloc(realptr,size+PREFIX_SIZE, MALLOC_LOCAL); if (newptr == NULL) { if (usable) *usable = 0; return NULL; diff --git a/tests/modules/Makefile b/tests/modules/Makefile index ae611de86..1beb217b8 100644 --- a/tests/modules/Makefile +++ b/tests/modules/Makefile @@ -32,6 +32,7 @@ TEST_MODULES = \ auth.so \ keyspace_events.so \ blockedclient.so \ + timers.so \ getkeys.so \ test_lazyfree.so \ timer.so \