From 8ab33c18e4c34dbf2e894adca5b9e74fd4348587 Mon Sep 17 00:00:00 2001 From: DarrenJiang13 Date: Tue, 10 Aug 2021 16:32:27 +0800 Subject: 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. --- src/zmalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/zmalloc.c') 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; -- cgit v1.2.1