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

Function tcaches_create_prep

deps/memkind/src/jemalloc/src/tcache.c:543–567  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

541}
542
543static bool
544tcaches_create_prep(tsd_t *tsd) {
545 bool err;
546
547 malloc_mutex_lock(tsd_tsdn(tsd), &tcaches_mtx);
548
549 if (tcaches == NULL) {
550 tcaches = base_alloc(tsd_tsdn(tsd), b0get(), sizeof(tcache_t *)
551 * (MALLOCX_TCACHE_MAX+1), CACHELINE);
552 if (tcaches == NULL) {
553 err = true;
554 goto label_return;
555 }
556 }
557
558 if (tcaches_avail == NULL && tcaches_past > MALLOCX_TCACHE_MAX) {
559 err = true;
560 goto label_return;
561 }
562
563 err = false;
564label_return:
565 malloc_mutex_unlock(tsd_tsdn(tsd), &tcaches_mtx);
566 return err;
567}
568
569bool
570tcaches_create(tsd_t *tsd, unsigned *r_ind) {

Callers 1

tcaches_createFunction · 0.70

Calls 5

base_allocFunction · 0.70
b0getFunction · 0.70
malloc_mutex_lockFunction · 0.50
tsd_tsdnFunction · 0.50
malloc_mutex_unlockFunction · 0.50

Tested by

no test coverage detected