diff options
author | Jason Evans <je@fb.com> | 2011-02-01 03:58:22 (GMT) |
---|---|---|
committer | Jason Evans <je@fb.com> | 2011-02-01 03:58:22 (GMT) |
commit | 31bfb3e7b0c48009c64a1375f6b8e5e7c5a29cdc (patch) | |
tree | 321413b07299517e47cdc88a48a7dbd7223b6a52 /jemalloc | |
parent | f256680f878cf3d4f9eb377ff345a90ef4845e75 (diff) | |
download | jemalloc-31bfb3e7b0c48009c64a1375f6b8e5e7c5a29cdc.zip jemalloc-31bfb3e7b0c48009c64a1375f6b8e5e7c5a29cdc.tar.gz jemalloc-31bfb3e7b0c48009c64a1375f6b8e5e7c5a29cdc.tar.bz2 |
Fix an alignment-related bug in huge_ralloc().
Fix huge_ralloc() to call huge_palloc() only if alignment requires it.
This bug caused under-sized allocation for aligned huge reallocation
(via rallocm()) if the requested alignment was less than the chunk size
(4 MiB by default).
Diffstat (limited to 'jemalloc')
-rw-r--r-- | jemalloc/src/huge.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/jemalloc/src/huge.c b/jemalloc/src/huge.c index 0aadc43..de09198 100644 --- a/jemalloc/src/huge.c +++ b/jemalloc/src/huge.c @@ -83,7 +83,7 @@ huge_palloc(size_t size, size_t alignment, bool zero) * alignment, in order to assure the alignment can be achieved, then * unmap leading and trailing chunks. */ - assert(alignment >= chunksize); + assert(alignment > chunksize); chunk_size = CHUNK_CEILING(size); @@ -192,7 +192,7 @@ huge_ralloc(void *ptr, size_t oldsize, size_t size, size_t extra, * different size class. In that case, fall back to allocating new * space and copying. */ - if (alignment != 0) + if (alignment > chunksize) ret = huge_palloc(size + extra, alignment, zero); else ret = huge_malloc(size + extra, zero); @@ -201,7 +201,7 @@ huge_ralloc(void *ptr, size_t oldsize, size_t size, size_t extra, if (extra == 0) return (NULL); /* Try again, this time without extra. */ - if (alignment != 0) + if (alignment > chunksize) ret = huge_palloc(size, alignment, zero); else ret = huge_malloc(size, zero); |