diff options
author | Jason Evans <je@fb.com> | 2016-02-25 01:18:44 (GMT) |
---|---|---|
committer | Jason Evans <je@fb.com> | 2016-02-25 01:23:18 (GMT) |
commit | c7a9a6c86b483d4aebb51bd62d902f4022a7367b (patch) | |
tree | 5a9022af8ddf5cbcbcf2d1571155570fe004f491 /src/chunk_mmap.c | |
parent | 5ec703dd33b60924ec39534d3fbc234dfa01b15a (diff) | |
download | jemalloc-c7a9a6c86b483d4aebb51bd62d902f4022a7367b.zip jemalloc-c7a9a6c86b483d4aebb51bd62d902f4022a7367b.tar.gz jemalloc-c7a9a6c86b483d4aebb51bd62d902f4022a7367b.tar.bz2 |
Attempt mmap-based in-place huge reallocation.
Attempt mmap-based in-place huge reallocation by plumbing new_addr into
chunk_alloc_mmap(). This can dramatically speed up incremental huge
reallocation.
This resolves #335.
Diffstat (limited to 'src/chunk_mmap.c')
-rw-r--r-- | src/chunk_mmap.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/chunk_mmap.c b/src/chunk_mmap.c index b9ba741..56b2ee4 100644 --- a/src/chunk_mmap.c +++ b/src/chunk_mmap.c @@ -32,7 +32,8 @@ chunk_alloc_mmap_slow(size_t size, size_t alignment, bool *zero, bool *commit) } void * -chunk_alloc_mmap(size_t size, size_t alignment, bool *zero, bool *commit) +chunk_alloc_mmap(void *new_addr, size_t size, size_t alignment, bool *zero, + bool *commit) { void *ret; size_t offset; @@ -53,9 +54,10 @@ chunk_alloc_mmap(size_t size, size_t alignment, bool *zero, bool *commit) assert(alignment != 0); assert((alignment & chunksize_mask) == 0); - ret = pages_map(NULL, size); - if (ret == NULL) - return (NULL); + ret = pages_map(new_addr, size); + if (ret == NULL || ret == new_addr) + return (ret); + assert(new_addr == NULL); offset = ALIGNMENT_ADDR2OFFSET(ret, alignment); if (offset != 0) { pages_unmap(ret, size); |