summaryrefslogtreecommitdiffstats
path: root/src/extent_dss.c
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2016-12-03 23:38:25 (GMT)
committerJason Evans <jasone@canonware.com>2016-12-27 02:08:16 (GMT)
commita6e86810d83aba0d94d0f6423ed09e8e6e0909fa (patch)
tree7ca1d2d92bdba5fd5ec01b01e3167f1f6dd875d9 /src/extent_dss.c
parent884fa22b8c8a23831eb4090fa92d191d6e3e394e (diff)
downloadjemalloc-a6e86810d83aba0d94d0f6423ed09e8e6e0909fa.zip
jemalloc-a6e86810d83aba0d94d0f6423ed09e8e6e0909fa.tar.gz
jemalloc-a6e86810d83aba0d94d0f6423ed09e8e6e0909fa.tar.bz2
Refactor purging and splitting/merging.
Split purging into lazy and forced variants. Use the forced variant for zeroing dss. Add support for NULL function pointers as an opt-out mechanism for the dalloc, commit, decommit, purge_lazy, purge_forced, split, and merge fields of extent_hooks_t. Add short-circuiting checks in large_ralloc_no_move_{shrink,expand}() so that no attempt is made if splitting/merging is not supported. This resolves #268.
Diffstat (limited to 'src/extent_dss.c')
-rw-r--r--src/extent_dss.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/extent_dss.c b/src/extent_dss.c
index 1169d49..0f0c689 100644
--- a/src/extent_dss.c
+++ b/src/extent_dss.c
@@ -168,10 +168,20 @@ extent_alloc_dss(tsdn_t *tsdn, arena_t *arena, void *new_addr, size_t size,
extent_dalloc_gap(tsdn, arena, gap);
else
extent_dalloc(tsdn, arena, gap);
- if (*zero)
- memset(ret, 0, size);
if (!*commit)
*commit = pages_decommit(ret, size);
+ if (*zero && *commit) {
+ extent_hooks_t *extent_hooks =
+ EXTENT_HOOKS_INITIALIZER;
+ extent_t extent;
+
+ extent_init(&extent, arena, ret, size,
+ size, 0, true, false, true, false);
+ if (extent_purge_forced_wrapper(tsdn,
+ arena, &extent_hooks, &extent, 0,
+ size))
+ memset(ret, 0, size);
+ }
return (ret);
}
/*