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

Function arena_init_locked

deps/jemalloc/src/jemalloc.c:317–343  ·  view source on GitHub ↗

Create a new arena and insert it into the arenas array at index ind. */

Source from the content-addressed store, hash-verified

315
316/* Create a new arena and insert it into the arenas array at index ind. */
317static arena_t *
318arena_init_locked(tsdn_t *tsdn, unsigned ind, extent_hooks_t *extent_hooks) {
319 arena_t *arena;
320
321 assert(ind <= narenas_total_get());
322 if (ind >= MALLOCX_ARENA_LIMIT) {
323 return NULL;
324 }
325 if (ind == narenas_total_get()) {
326 narenas_total_inc();
327 }
328
329 /*
330 * Another thread may have already initialized arenas[ind] if it's an
331 * auto arena.
332 */
333 arena = arena_get(tsdn, ind, false);
334 if (arena != NULL) {
335 assert(arena_is_auto(arena));
336 return arena;
337 }
338
339 /* Actually initialize the arena. */
340 arena = arena_new(tsdn, ind, extent_hooks);
341
342 return arena;
343}
344
345static void
346arena_new_create_background_thread(tsdn_t *tsdn, unsigned ind) {

Callers 2

arena_initFunction · 0.70
arena_choose_hardFunction · 0.70

Calls 5

narenas_total_getFunction · 0.70
narenas_total_incFunction · 0.70
arena_newFunction · 0.70
arena_getFunction · 0.50
arena_is_autoFunction · 0.50

Tested by

no test coverage detected