diff --git a/deps/Makefile b/deps/Makefile index 190a648a8..28cf4e01d 100644 --- a/deps/Makefile +++ b/deps/Makefile @@ -95,7 +95,7 @@ JEMALLOC_LDFLAGS= $(LDFLAGS) jemalloc: .make-prerequisites @printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR) - cd jemalloc && ./configure --with-version=5.2.1-0-g0 --with-lg-quantum=3 --with-jemalloc-prefix=je_ --disable-cxx CFLAGS="$(JEMALLOC_CFLAGS)" LDFLAGS="$(JEMALLOC_LDFLAGS)" + cd jemalloc && ./configure --with-version=5.2.1-0-g0 --with-lg-quantum=3 --disable-cxx CFLAGS="$(JEMALLOC_CFLAGS)" LDFLAGS="$(JEMALLOC_LDFLAGS)" cd jemalloc && $(MAKE) CFLAGS="$(JEMALLOC_CFLAGS)" LDFLAGS="$(JEMALLOC_LDFLAGS)" lib/libjemalloc.a .PHONY: jemalloc diff --git a/deps/rocksdb b/deps/rocksdb index e3169e3ea..444b3f484 160000 --- a/deps/rocksdb +++ b/deps/rocksdb @@ -1 +1 @@ -Subproject commit e3169e3ea8762d2f34880742106858a23c8dc8b7 +Subproject commit 444b3f4845dd01b0d127c4b420fdd3b50ad56682 diff --git a/src/Makefile b/src/Makefile index 572d173d5..f67f85b5a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -25,7 +25,7 @@ NODEPS:=clean distclean # Default settings STD=-pedantic -DREDIS_STATIC='' -CXX_STD=-std=c++14 -pedantic -fno-rtti -D__STDC_FORMAT_MACROS +CXX_STD=-std=c++17 -pedantic -fno-rtti -D__STDC_FORMAT_MACROS ifneq (,$(findstring clang,$(CC))) STD+=-Wno-c11-extensions else diff --git a/src/debug.cpp b/src/debug.cpp index b709937c9..688ca3a0e 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -341,10 +341,10 @@ void mallctl_int(client *c, robj **argv, int argc) { } size_t sz = sizeof(old); while (sz > 0) { - if ((ret=je_mallctl(szFromObj(argv[0]), &old, &sz, argc > 1? &val: NULL, argc > 1?sz: 0))) { + if ((ret=mallctl(szFromObj(argv[0]), &old, &sz, argc > 1? &val: NULL, argc > 1?sz: 0))) { if (ret == EPERM && argc > 1) { /* if this option is write only, try just writing to it. */ - if (!(ret=je_mallctl(szFromObj(argv[0]), NULL, 0, &val, sz))) { + if (!(ret=mallctl(szFromObj(argv[0]), NULL, 0, &val, sz))) { addReply(c, shared.ok); return; } @@ -375,7 +375,7 @@ void mallctl_string(client *c, robj **argv, int argc) { char *old; size_t sz = sizeof(old); /* for strings, it seems we need to first get the old value, before overriding it. */ - if ((rret=je_mallctl(szFromObj(argv[0]), &old, &sz, NULL, 0))) { + if ((rret=mallctl(szFromObj(argv[0]), &old, &sz, NULL, 0))) { /* return error unless this option is write only. */ if (!(rret == EPERM && argc > 1)) { addReplyErrorFormat(c,"%s", strerror(rret)); @@ -387,7 +387,7 @@ void mallctl_string(client *c, robj **argv, int argc) { char **valref = &val; if ((!strcmp(val,"VOID"))) valref = NULL, sz = 0; - wret = je_mallctl(szFromObj(argv[0]), NULL, 0, valref, sz); + wret = mallctl(szFromObj(argv[0]), NULL, 0, valref, sz); } if (!rret) addReplyBulkCString(c, old); diff --git a/src/new.cpp b/src/new.cpp index 4e6b07dfd..3a299e7bf 100644 --- a/src/new.cpp +++ b/src/new.cpp @@ -41,10 +41,3 @@ void operator delete(void *p, std::size_t) noexcept } #endif - -#if defined(USE_JEMALLOC) -extern "C" size_t malloc_usable_size(void *ptr) -{ - return zmalloc_usable_size(ptr); -} -#endif diff --git a/src/object.cpp b/src/object.cpp index b7d0ec15f..9b5ada3af 100644 --- a/src/object.cpp +++ b/src/object.cpp @@ -1541,7 +1541,7 @@ void memoryCommand(client *c) { } else if (!strcasecmp(szFromObj(c->argv[1]),"malloc-stats") && c->argc == 2) { #if defined(USE_JEMALLOC) sds info = sdsempty(); - je_malloc_stats_print(inputCatSds, &info, NULL); + malloc_stats_print(inputCatSds, &info, NULL); addReplyVerbatim(c,info,sdslen(info),"txt"); sdsfree(info); #else diff --git a/src/server.h b/src/server.h index 23eb912bc..ae3611fc2 100644 --- a/src/server.h +++ b/src/server.h @@ -3894,13 +3894,13 @@ void incrementMvccTstamp(); #if __GNUC__ >= 7 && !defined(NO_DEPRECATE_FREE) [[deprecated]] -void *calloc(size_t count, size_t size); +void *calloc(size_t count, size_t size) noexcept; [[deprecated]] -void free(void *ptr); +void free(void *ptr) noexcept; [[deprecated]] -void *malloc(size_t size); +void *malloc(size_t size) noexcept; [[deprecated]] -void *realloc(void *ptr, size_t size); +void *realloc(void *ptr, size_t size) noexcept; #endif /* Debugging stuff */ diff --git a/src/zmalloc.cpp b/src/zmalloc.cpp index 2e66a57ee..81bd47f42 100644 --- a/src/zmalloc.cpp +++ b/src/zmalloc.cpp @@ -80,12 +80,12 @@ static_assert((PREFIX_SIZE % 16) == 0, "Our prefix must be modulo 16-bytes or ou #define realloc(ptr,size, type) tc_realloc(ptr,size) #define free(ptr) tc_free(ptr) #elif defined(USE_JEMALLOC) -#define malloc(size, type) je_malloc(size) -#define calloc(count,size,type) je_calloc(count,size) -#define realloc(ptr,size,type) je_realloc(ptr,size) -#define free(ptr) je_free(ptr) -#define mallocx(size,flags) je_mallocx(size,flags) -#define dallocx(ptr,flags) je_dallocx(ptr,flags) +#define malloc(size, type) malloc(size) +#define calloc(count,size,type) calloc(count,size) +#define realloc(ptr,size,type) realloc(ptr,size) +#define free(ptr) free(ptr) +#define mallocx(size,flags) mallocx(size,flags) +#define dallocx(ptr,flags) dallocx(ptr,flags) #else #define malloc(size, type) malloc(size) #define calloc(count,size,type) calloc(count,size) @@ -494,17 +494,17 @@ int zmalloc_get_allocator_info(size_t *allocated, *allocated = *resident = *active = 0; /* Update the statistics cached by mallctl. */ sz = sizeof(epoch); - je_mallctl("epoch", &epoch, &sz, &epoch, sz); + mallctl("epoch", &epoch, &sz, &epoch, sz); sz = sizeof(size_t); /* Unlike RSS, this does not include RSS from shared libraries and other non * heap mappings. */ - je_mallctl("stats.resident", resident, &sz, NULL, 0); + mallctl("stats.resident", resident, &sz, NULL, 0); /* Unlike resident, this doesn't not include the pages jemalloc reserves * for re-use (purge will clean that). */ - je_mallctl("stats.active", active, &sz, NULL, 0); + mallctl("stats.active", active, &sz, NULL, 0); /* Unlike zmalloc_used_memory, this matches the stats.resident by taking * into account all allocations done by this process (not only zmalloc). */ - je_mallctl("stats.allocated", allocated, &sz, NULL, 0); + mallctl("stats.allocated", allocated, &sz, NULL, 0); return 1; } @@ -512,7 +512,7 @@ void set_jemalloc_bg_thread(int enable) { /* let jemalloc do purging asynchronously, required when there's no traffic * after flushdb */ char val = !!enable; - je_mallctl("background_thread", NULL, 0, &val, 1); + mallctl("background_thread", NULL, 0, &val, 1); } int jemalloc_purge() { @@ -520,9 +520,9 @@ int jemalloc_purge() { char tmp[32]; unsigned narenas = 0; size_t sz = sizeof(unsigned); - if (!je_mallctl("arenas.narenas", &narenas, &sz, NULL, 0)) { + if (!mallctl("arenas.narenas", &narenas, &sz, NULL, 0)) { snprintf(tmp, sizeof(tmp), "arena.%d.purge", narenas); - if (!je_mallctl(tmp, NULL, 0, NULL, 0)) + if (!mallctl(tmp, NULL, 0, NULL, 0)) return 0; } return -1; diff --git a/src/zmalloc.h b/src/zmalloc.h index 7816bbae0..75b205b96 100644 --- a/src/zmalloc.h +++ b/src/zmalloc.h @@ -55,7 +55,7 @@ #include #if (JEMALLOC_VERSION_MAJOR == 2 && JEMALLOC_VERSION_MINOR >= 1) || (JEMALLOC_VERSION_MAJOR > 2) #define HAVE_MALLOC_SIZE 1 -#define zmalloc_size(p) je_malloc_usable_size(p) +#define zmalloc_size(p) malloc_usable_size(p) #else #error "Newer version of jemalloc required" #endif