summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQi Wang <interwq@gwu.edu>2017-06-13 23:16:33 (GMT)
committerQi Wang <interwq@gmail.com>2017-06-14 16:34:29 (GMT)
commitd955d6f2be7f17ba1f9a81f457e72565474cf18d (patch)
treeeff18f4a796b5d9f2e268cf5371b0306ad5f9dd1 /src
parent5018fe3f0979b7f9db9930accdf7ee31071fd703 (diff)
downloadjemalloc-d955d6f2be7f17ba1f9a81f457e72565474cf18d.zip
jemalloc-d955d6f2be7f17ba1f9a81f457e72565474cf18d.tar.gz
jemalloc-d955d6f2be7f17ba1f9a81f457e72565474cf18d.tar.bz2
Fix extent_hooks in extent_grow_retained().
This issue caused the default extent alloc function to be incorrectly used even when arena.<i>.extent_hooks is set. This bug was introduced by 411697adcda2fd75e135cdcdafb95f2bd295dc7f (Use exponential series to size extents.), which was first released in 5.0.0.
Diffstat (limited to 'src')
-rw-r--r--src/extent.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/extent.c b/src/extent.c
index 386a7ce..f31ed32 100644
--- a/src/extent.c
+++ b/src/extent.c
@@ -1066,9 +1066,18 @@ extent_grow_retained(tsdn_t *tsdn, arena_t *arena,
}
bool zeroed = false;
bool committed = false;
- void *ptr = extent_alloc_core(tsdn, arena, NULL, alloc_size, PAGE,
- &zeroed, &committed, (dss_prec_t)atomic_load_u(&arena->dss_prec,
- ATOMIC_RELAXED));
+
+ void *ptr;
+ if (*r_extent_hooks == &extent_hooks_default) {
+ ptr = extent_alloc_core(tsdn, arena, NULL, alloc_size, PAGE,
+ &zeroed, &committed, (dss_prec_t)atomic_load_u(
+ &arena->dss_prec, ATOMIC_RELAXED));
+ } else {
+ ptr = (*r_extent_hooks)->alloc(*r_extent_hooks, NULL,
+ alloc_size, PAGE, &zeroed, &committed,
+ arena_ind_get(arena));
+ }
+
extent_init(extent, arena, ptr, alloc_size, false, NSIZES,
arena_extent_sn_next(arena), extent_state_active, zeroed,
committed);