diff options
author | jasone <jasone@FreeBSD.org> | 2012-11-10 01:46:13 +0000 |
---|---|---|
committer | jasone <jasone@FreeBSD.org> | 2012-11-10 01:46:13 +0000 |
commit | 85bcb5c4d44f8fbc63a4640845c509f1af63e2d0 (patch) | |
tree | 259ea73d4da6fff525da091d1c46c6809a58621f /contrib/jemalloc/src/chunk_mmap.c | |
parent | 078e4805d0a8dd714dd4d34c0e52c6ed816d4784 (diff) | |
download | FreeBSD-src-85bcb5c4d44f8fbc63a4640845c509f1af63e2d0.zip FreeBSD-src-85bcb5c4d44f8fbc63a4640845c509f1af63e2d0.tar.gz |
Import jemalloc 3.2.0.
Diffstat (limited to 'contrib/jemalloc/src/chunk_mmap.c')
-rw-r--r-- | contrib/jemalloc/src/chunk_mmap.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/contrib/jemalloc/src/chunk_mmap.c b/contrib/jemalloc/src/chunk_mmap.c index c8da655..8a42e75 100644 --- a/contrib/jemalloc/src/chunk_mmap.c +++ b/contrib/jemalloc/src/chunk_mmap.c @@ -113,22 +113,30 @@ pages_trim(void *addr, size_t alloc_size, size_t leadsize, size_t size) #endif } -void +bool pages_purge(void *addr, size_t length) { + bool unzeroed; #ifdef _WIN32 VirtualAlloc(addr, length, MEM_RESET, PAGE_READWRITE); + unzeroed = true; #else # ifdef JEMALLOC_PURGE_MADVISE_DONTNEED # define JEMALLOC_MADV_PURGE MADV_DONTNEED +# define JEMALLOC_MADV_ZEROS true # elif defined(JEMALLOC_PURGE_MADVISE_FREE) # define JEMALLOC_MADV_PURGE MADV_FREE +# define JEMALLOC_MADV_ZEROS false # else # error "No method defined for purging unused dirty pages." # endif - madvise(addr, length, JEMALLOC_MADV_PURGE); + int err = madvise(addr, length, JEMALLOC_MADV_PURGE); + unzeroed = (JEMALLOC_MADV_ZEROS == false || err != 0); +# undef JEMALLOC_MADV_PURGE +# undef JEMALLOC_MADV_ZEROS #endif + return (unzeroed); } static void * |