summaryrefslogtreecommitdiffstats
path: root/src/chunk_mmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/chunk_mmap.c')
-rw-r--r--src/chunk_mmap.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/chunk_mmap.c b/src/chunk_mmap.c
index f960e06..65137b4 100644
--- a/src/chunk_mmap.c
+++ b/src/chunk_mmap.c
@@ -121,7 +121,7 @@ pages_purge(void *addr, size_t length)
#ifdef _WIN32
VirtualAlloc(addr, length, MEM_RESET, PAGE_READWRITE);
unzeroed = true;
-#else
+#elif defined(JEMALLOC_HAVE_MADVISE)
# ifdef JEMALLOC_PURGE_MADVISE_DONTNEED
# define JEMALLOC_MADV_PURGE MADV_DONTNEED
# define JEMALLOC_MADV_ZEROS true
@@ -129,12 +129,15 @@ pages_purge(void *addr, size_t length)
# define JEMALLOC_MADV_PURGE MADV_FREE
# define JEMALLOC_MADV_ZEROS false
# else
-# error "No method defined for purging unused dirty pages."
+# error "No madvise(2) flag defined for purging unused dirty pages."
# endif
int err = madvise(addr, length, JEMALLOC_MADV_PURGE);
unzeroed = (JEMALLOC_MADV_ZEROS == false || err != 0);
# undef JEMALLOC_MADV_PURGE
# undef JEMALLOC_MADV_ZEROS
+#else
+ /* Last resort no-op. */
+ unzeroed = true;
#endif
return (unzeroed);
}