diff options
author | Richard Diamond <wichard@vitalitystudios.com> | 2014-06-03 07:39:18 (GMT) |
---|---|---|
committer | Jason Evans <je@fb.com> | 2014-06-03 16:32:49 (GMT) |
commit | 994fad9bdaaa18273f2089856c2637cfb0c307bd (patch) | |
tree | c1954510d9c8ab3ea1e2b2cce4a6aa184d9525a1 /src/chunk_mmap.c | |
parent | 70807bc54b06bb259b6607541af44bc73a890bf6 (diff) | |
download | jemalloc-994fad9bdaaa18273f2089856c2637cfb0c307bd.zip jemalloc-994fad9bdaaa18273f2089856c2637cfb0c307bd.tar.gz jemalloc-994fad9bdaaa18273f2089856c2637cfb0c307bd.tar.bz2 |
Add check for madvise(2) to configure.ac.
Some platforms, such as Google's Portable Native Client, use Newlib and
thus lack access to madvise(2). In those instances, pages_purge() is
transformed into a no-op.
Diffstat (limited to 'src/chunk_mmap.c')
-rw-r--r-- | src/chunk_mmap.c | 7 |
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); } |