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.
This commit is contained in:
parent
30949da601
commit
6d8075f1e6
@ -16,6 +16,10 @@ brevity. Much more detail can be found in the git revision history:
|
|||||||
- Add JEMALLOC_CXX_THROW to the memalign() function prototype, in order to
|
- Add JEMALLOC_CXX_THROW to the memalign() function prototype, in order to
|
||||||
match glibc and avoid compilation errors when including both
|
match glibc and avoid compilation errors when including both
|
||||||
jemalloc/jemalloc.h and malloc.h in C++ code.
|
jemalloc/jemalloc.h and malloc.h in C++ code.
|
||||||
|
- 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.
|
||||||
|
|
||||||
* 4.0.0 (August 17, 2015)
|
* 4.0.0 (August 17, 2015)
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ huge_ralloc_no_move_similar(void *ptr, size_t oldsize, size_t usize,
|
|||||||
if (oldsize > usize) {
|
if (oldsize > usize) {
|
||||||
size_t sdiff = oldsize - usize;
|
size_t sdiff = oldsize - usize;
|
||||||
zeroed = !chunk_purge_wrapper(arena, &chunk_hooks, ptr,
|
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)) {
|
if (config_fill && unlikely(opt_junk_free)) {
|
||||||
memset((void *)((uintptr_t)ptr + usize), 0x5a, sdiff);
|
memset((void *)((uintptr_t)ptr + usize), 0x5a, sdiff);
|
||||||
zeroed = false;
|
zeroed = false;
|
||||||
@ -204,7 +204,7 @@ huge_ralloc_no_move_shrink(void *ptr, size_t oldsize, size_t usize)
|
|||||||
size_t sdiff = oldsize - usize;
|
size_t sdiff = oldsize - usize;
|
||||||
zeroed = !chunk_purge_wrapper(arena, &chunk_hooks,
|
zeroed = !chunk_purge_wrapper(arena, &chunk_hooks,
|
||||||
CHUNK_ADDR2BASE((uintptr_t)ptr + usize),
|
CHUNK_ADDR2BASE((uintptr_t)ptr + usize),
|
||||||
CHUNK_CEILING(usize), CHUNK_ADDR2OFFSET((uintptr_t)ptr +
|
CHUNK_CEILING(oldsize), CHUNK_ADDR2OFFSET((uintptr_t)ptr +
|
||||||
usize), sdiff);
|
usize), sdiff);
|
||||||
if (config_fill && unlikely(opt_junk_free)) {
|
if (config_fill && unlikely(opt_junk_free)) {
|
||||||
huge_dalloc_junk((void *)((uintptr_t)ptr + usize),
|
huge_dalloc_junk((void *)((uintptr_t)ptr + usize),
|
||||||
|
Loading…
Reference in New Issue
Block a user