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

Function base_map

deps/jemalloc/src/base.c:31–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29}
30
31static void *
32base_map(tsdn_t *tsdn, extent_hooks_t *extent_hooks, unsigned ind, size_t size) {
33 void *addr;
34 bool zero = true;
35 bool commit = true;
36
37 /* Use huge page sizes and alignment regardless of opt_metadata_thp. */
38 assert(size == HUGEPAGE_CEILING(size));
39 size_t alignment = HUGEPAGE;
40 if (extent_hooks == &extent_hooks_default) {
41 addr = extent_alloc_mmap(NULL, size, alignment, &zero, &commit);
42 } else {
43 /* No arena context as we are creating new arenas. */
44 tsd_t *tsd = tsdn_null(tsdn) ? tsd_fetch() : tsdn_tsd(tsdn);
45 pre_reentrancy(tsd, NULL);
46 addr = extent_hooks->alloc(extent_hooks, NULL, size, alignment,
47 &zero, &commit, ind);
48 post_reentrancy(tsd);
49 }
50
51 return addr;
52}
53
54static void
55base_unmap(tsdn_t *tsdn, extent_hooks_t *extent_hooks, unsigned ind, void *addr,

Callers 1

base_block_allocFunction · 0.70

Calls 7

allocMethod · 0.80
extent_alloc_mmapFunction · 0.70
tsdn_nullFunction · 0.50
tsd_fetchFunction · 0.50
tsdn_tsdFunction · 0.50
pre_reentrancyFunction · 0.50
post_reentrancyFunction · 0.50

Tested by

no test coverage detected