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

Function arena_i_destroy_ctl

deps/jemalloc/src/ctl.c:2206–2245  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2204}
2205
2206static int
2207arena_i_destroy_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
2208 size_t *oldlenp, void *newp, size_t newlen) {
2209 int ret;
2210 unsigned arena_ind;
2211 arena_t *arena;
2212 ctl_arena_t *ctl_darena, *ctl_arena;
2213
2214 ret = arena_i_reset_destroy_helper(tsd, mib, miblen, oldp, oldlenp,
2215 newp, newlen, &arena_ind, &arena);
2216 if (ret != 0) {
2217 goto label_return;
2218 }
2219
2220 if (arena_nthreads_get(arena, false) != 0 || arena_nthreads_get(arena,
2221 true) != 0) {
2222 ret = EFAULT;
2223 goto label_return;
2224 }
2225
2226 arena_reset_prepare_background_thread(tsd, arena_ind);
2227 /* Merge stats after resetting and purging arena. */
2228 arena_reset(tsd, arena);
2229 arena_decay(tsd_tsdn(tsd), arena, false, true);
2230 ctl_darena = arenas_i(MALLCTL_ARENAS_DESTROYED);
2231 ctl_darena->initialized = true;
2232 ctl_arena_refresh(tsd_tsdn(tsd), arena, ctl_darena, arena_ind, true);
2233 /* Destroy arena. */
2234 arena_destroy(tsd, arena);
2235 ctl_arena = arenas_i(arena_ind);
2236 ctl_arena->initialized = false;
2237 /* Record arena index for later recycling via arenas.create. */
2238 ql_elm_new(ctl_arena, destroyed_link);
2239 ql_tail_insert(&ctl_arenas->destroyed, ctl_arena, destroyed_link);
2240 arena_reset_finish_background_thread(tsd, arena_ind);
2241
2242 assert(ret == 0);
2243label_return:
2244 return ret;
2245}
2246
2247static int
2248arena_i_dss_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,

Callers

nothing calls this directly

Calls 10

arena_nthreads_getFunction · 0.70
arena_resetFunction · 0.70
arena_decayFunction · 0.70
arenas_iFunction · 0.70
ctl_arena_refreshFunction · 0.70
arena_destroyFunction · 0.70
tsd_tsdnFunction · 0.50

Tested by

no test coverage detected