From b1431fafaca30fc413817b67c07a146c256c2f2a Mon Sep 17 00:00:00 2001 From: Sher Sun Date: Tue, 30 Apr 2024 17:18:31 +0000 Subject: [PATCH] remove defrag_supported macro Signed-off-by: Sher Sun --- src/server.c | 8 ++++++-- src/zmalloc.h | 7 ------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/server.c b/src/server.c index 3c7fbcd111..eef241a3bd 100644 --- a/src/server.c +++ b/src/server.c @@ -5757,8 +5757,12 @@ sds genRedisInfoString(dict *section_dict, int all_sections, int everything) { "mem_overhead_db_hashtable_rehashing:%zu\r\n", mh->overhead_db_hashtable_rehashing, "active_defrag_running:%d\r\n", server.active_defrag_running, "lazyfree_pending_objects:%zu\r\n", lazyfreeGetPendingObjectsCount(), - "lazyfreed_objects:%zu\r\n", lazyfreeGetFreedObjectsCount(), - "defrag_supported: %s\r\n", defrag_supported)); +#ifdef USE_JEMALLOC + "defrag_supported: %s\r\n", "yes", +#else + "defrag_supported: %s\r\n", "no", +#endif + "lazyfreed_objects:%zu\r\n", lazyfreeGetFreedObjectsCount())); freeMemoryOverheadData(mh); } diff --git a/src/zmalloc.h b/src/zmalloc.h index 3714abdd93..ca93b1ea92 100644 --- a/src/zmalloc.h +++ b/src/zmalloc.h @@ -37,7 +37,6 @@ #if defined(USE_TCMALLOC) #define ZMALLOC_LIB ("tcmalloc-" __xstr(TC_VERSION_MAJOR) "." __xstr(TC_VERSION_MINOR)) -#define defrag_supported "no" #include #if (TC_VERSION_MAJOR == 1 && TC_VERSION_MINOR >= 6) || (TC_VERSION_MAJOR > 1) #define HAVE_MALLOC_SIZE 1 @@ -48,7 +47,6 @@ #elif defined(USE_JEMALLOC) #define ZMALLOC_LIB ("jemalloc-" __xstr(JEMALLOC_VERSION_MAJOR) "." __xstr(JEMALLOC_VERSION_MINOR) "." __xstr(JEMALLOC_VERSION_BUGFIX)) -#define defrag_supported "yes" #include #if (JEMALLOC_VERSION_MAJOR == 2 && JEMALLOC_VERSION_MINOR >= 1) || (JEMALLOC_VERSION_MAJOR > 2) #define HAVE_MALLOC_SIZE 1 @@ -58,7 +56,6 @@ #endif #elif defined(USE_MIMALLOC) -#define defrag_supported "no" #include #define ZMALLOC_LIB ("mimalloc-" __xstr(MI_MALLOC_VERSION)) #define MI_VERSION_MAJOR (MI_MALLOC_VERSION / 100) @@ -89,10 +86,6 @@ #define ZMALLOC_LIB "libc" #define USE_LIBC 1 -#ifndef defrag_supported -#define defrag_supported "no" -#endif - #if !defined(NO_MALLOC_USABLE_SIZE) && \ (defined(__GLIBC__) || defined(__FreeBSD__) || \ defined(__DragonFly__) || defined(__HAIKU__) || \