MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / ctl_arena_init

Function ctl_arena_init

deps/jemalloc/src/ctl.c:1003–1031  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1001}
1002
1003static unsigned
1004ctl_arena_init(tsd_t *tsd, extent_hooks_t *extent_hooks) {
1005 unsigned arena_ind;
1006 ctl_arena_t *ctl_arena;
1007
1008 if ((ctl_arena = ql_last(&ctl_arenas->destroyed, destroyed_link)) !=
1009 NULL) {
1010 ql_remove(&ctl_arenas->destroyed, ctl_arena, destroyed_link);
1011 arena_ind = ctl_arena->arena_ind;
1012 } else {
1013 arena_ind = ctl_arenas->narenas;
1014 }
1015
1016 /* Trigger stats allocation. */
1017 if (arenas_i_impl(tsd, arena_ind, false, true) == NULL) {
1018 return UINT_MAX;
1019 }
1020
1021 /* Initialize new arena. */
1022 if (arena_init(tsd_tsdn(tsd), arena_ind, extent_hooks) == NULL) {
1023 return UINT_MAX;
1024 }
1025
1026 if (arena_ind == ctl_arenas->narenas) {
1027 ctl_arenas->narenas++;
1028 }
1029
1030 return arena_ind;
1031}
1032
1033static void
1034ctl_background_thread_stats_read(tsdn_t *tsdn) {

Callers 1

arenas_create_ctlFunction · 0.70

Calls 3

arenas_i_implFunction · 0.70
arena_initFunction · 0.70
tsd_tsdnFunction · 0.50

Tested by

no test coverage detected