diff options
author | Mike Hommey <mh@glandium.org> | 2015-08-27 20:30:15 -0700 |
---|---|---|
committer | Jason Evans <je@fb.com> | 2015-08-27 20:32:57 -0700 |
commit | 6d8075f1e6e72ee274832f1164c164f713788e34 (patch) | |
tree | db676ec56d367272edf003b839d7b29601ca2672 /src | |
parent | 30949da601f7405c294a71d30bd67be29cfbc2a5 (diff) | |
download | jemalloc-6d8075f1e6e72ee274832f1164c164f713788e34.tar.gz |
Fix chunk purge hook calls for in-place huge shrinking reallocation.
Fix chunk purge hook calls for in-place huge shrinking reallocation to
specify the old chunk size rather than the new chunk size. This bug
caused no correctness issues for the default chunk purge function, but
was visible to custom functions set via the "arena.<i>.chunk_hooks"
mallctl.
This resolves #264.
Diffstat (limited to 'src')
-rw-r--r-- | src/huge.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -149,7 +149,7 @@ huge_ralloc_no_move_similar(void *ptr, size_t oldsize, size_t usize, if (oldsize > usize) { size_t sdiff = oldsize - usize; zeroed = !chunk_purge_wrapper(arena, &chunk_hooks, ptr, - CHUNK_CEILING(usize), usize, sdiff); + CHUNK_CEILING(oldsize), usize, sdiff); if (config_fill && unlikely(opt_junk_free)) { memset((void *)((uintptr_t)ptr + usize), 0x5a, sdiff); zeroed = false; @@ -204,7 +204,7 @@ huge_ralloc_no_move_shrink(void *ptr, size_t oldsize, size_t usize) size_t sdiff = oldsize - usize; zeroed = !chunk_purge_wrapper(arena, &chunk_hooks, CHUNK_ADDR2BASE((uintptr_t)ptr + usize), - CHUNK_CEILING(usize), CHUNK_ADDR2OFFSET((uintptr_t)ptr + + CHUNK_CEILING(oldsize), CHUNK_ADDR2OFFSET((uintptr_t)ptr + usize), sdiff); if (config_fill && unlikely(opt_junk_free)) { huge_dalloc_junk((void *)((uintptr_t)ptr + usize), |