summaryrefslogtreecommitdiff
path: root/src/zmalloc.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/zmalloc.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/zmalloc.c')
-rw-r--r--src/zmalloc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/zmalloc.c b/src/zmalloc.c
index 012dadd2f..b68f6b46a 100644
--- a/src/zmalloc.c
+++ b/src/zmalloc.c
@@ -346,7 +346,7 @@ void zmalloc_set_oom_handler(void (*oom_handler)(size_t)) {
* We do that in a fork child process to avoid CoW when the parent modifies
* these shared pages. */
void zmadvise_dontneed(void *ptr) {
-#if defined(USE_JEMALLOC)
+#if defined(USE_JEMALLOC) && defined(__linux__)
static size_t page_size = 0;
if (page_size == 0) page_size = sysconf(_SC_PAGESIZE);
size_t page_size_mask = page_size - 1;