diff options
| author | Jason Evans <jasone@canonware.com> | 2016-05-12 21:51:07 (GMT) |
|---|---|---|
| committer | Jason Evans <jasone@canonware.com> | 2016-05-12 21:53:25 (GMT) |
| commit | f70a254d44c8d30af2cd5d30531fb18fdabaae6d (patch) | |
| tree | 4e226a1bd0d56d742ca0950f69829ed7f0216e62 /src/chunk_mmap.c | |
| parent | e02b83cc5e3c4d30f93dba945162e3aa58d962d6 (diff) | |
| parent | 09f8585ce8a57baa387cc0327e51c0baffbdce6f (diff) | |
| download | jemalloc-4.2.0.zip jemalloc-4.2.0.tar.gz jemalloc-4.2.0.tar.bz2 | |
Merge branch 'dev'4.2.0
Diffstat (limited to 'src/chunk_mmap.c')
| -rw-r--r-- | src/chunk_mmap.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/chunk_mmap.c b/src/chunk_mmap.c index 56b2ee4..f95ae75 100644 --- a/src/chunk_mmap.c +++ b/src/chunk_mmap.c @@ -9,25 +9,23 @@ chunk_alloc_mmap_slow(size_t size, size_t alignment, bool *zero, bool *commit) void *ret; size_t alloc_size; - alloc_size = size + alignment - PAGE; + alloc_size = size + alignment; /* Beware size_t wrap-around. */ if (alloc_size < size) return (NULL); do { void *pages; size_t leadsize; - pages = pages_map(NULL, alloc_size); + pages = pages_map(NULL, alloc_size, commit); if (pages == NULL) return (NULL); leadsize = ALIGNMENT_CEILING((uintptr_t)pages, alignment) - (uintptr_t)pages; - ret = pages_trim(pages, alloc_size, leadsize, size); + ret = pages_trim(pages, alloc_size, leadsize, size, commit); } while (ret == NULL); assert(ret != NULL); *zero = true; - if (!*commit) - *commit = pages_decommit(ret, size); return (ret); } @@ -54,7 +52,7 @@ chunk_alloc_mmap(void *new_addr, size_t size, size_t alignment, bool *zero, assert(alignment != 0); assert((alignment & chunksize_mask) == 0); - ret = pages_map(new_addr, size); + ret = pages_map(new_addr, size, commit); if (ret == NULL || ret == new_addr) return (ret); assert(new_addr == NULL); @@ -66,8 +64,6 @@ chunk_alloc_mmap(void *new_addr, size_t size, size_t alignment, bool *zero, assert(ret != NULL); *zero = true; - if (!*commit) - *commit = pages_decommit(ret, size); return (ret); } |
