summaryrefslogtreecommitdiff
path: root/src/object.c
diff options
context:
space:
mode:
authorDarrenJiang13 <yjjiang1996@163.com>2021-08-10 16:32:27 +0800
committerGitHub <noreply@github.com>2021-08-10 11:32:27 +0300
commit8ab33c18e4c34dbf2e894adca5b9e74fd4348587 (patch)
tree21cbd94819b44d75cfa635d6dc5cf4ac60607593 /src/object.c
parent8f8117f78e004fa5f5808239dcaedf9acdb8c828 (diff)
downloadredis-8ab33c18e4c34dbf2e894adca5b9e74fd4348587.tar.gz
fix a compilation error around madvise when make with jemalloc on MacOS (#9350)
We only use MADV_DONTNEED on Linux, that's were it was tested.
Diffstat (limited to 'src/object.c')
-rw-r--r--src/object.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/object.c b/src/object.c
index a5705ea5a..2e27d69f6 100644
--- a/src/object.c
+++ b/src/object.c
@@ -537,9 +537,9 @@ void dismissObject(robj *o, size_t size_hint) {
/* madvise(MADV_DONTNEED) may not work if Transparent Huge Pages is enabled. */
if (server.thp_enabled) return;
- /* Currently we use zmadvise_dontneed only when we use jemalloc.
+ /* Currently we use zmadvise_dontneed only when we use jemalloc with Linux.
* so we avoid these pointless loops when they're not going to do anything. */
-#if defined(USE_JEMALLOC)
+#if defined(USE_JEMALLOC) && defined(__linux__)
if (o->refcount != 1) return;
switch(o->type) {
case OBJ_STRING: dismissStringObject(o); break;