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

Function imalloc_no_sample

deps/memkind/src/jemalloc/src/jemalloc.c:1612–1652  ·  view source on GitHub ↗

ind is ignored if dopts->alignment > 0. */

Source from the content-addressed store, hash-verified

1610
1611/* ind is ignored if dopts->alignment > 0. */
1612JEMALLOC_ALWAYS_INLINE void *
1613imalloc_no_sample(static_opts_t *sopts, dynamic_opts_t *dopts, tsd_t *tsd,
1614 size_t size, size_t usize, szind_t ind) {
1615 tcache_t *tcache;
1616 arena_t *arena;
1617
1618 /* Fill in the tcache. */
1619 if (dopts->tcache_ind == TCACHE_IND_AUTOMATIC) {
1620 if (likely(!sopts->slow)) {
1621 /* Getting tcache ptr unconditionally. */
1622 tcache = tsd_tcachep_get(tsd);
1623 assert(tcache == tcache_get(tsd));
1624 } else {
1625 tcache = tcache_get(tsd);
1626 }
1627 } else if (dopts->tcache_ind == TCACHE_IND_NONE) {
1628 tcache = NULL;
1629 } else {
1630 tcache = tcaches_get(tsd, dopts->tcache_ind);
1631 }
1632
1633 /* Fill in the arena. */
1634 if (dopts->arena_ind == ARENA_IND_AUTOMATIC) {
1635 /*
1636 * In case of automatic arena management, we defer arena
1637 * computation until as late as we can, hoping to fill the
1638 * allocation out of the tcache.
1639 */
1640 arena = NULL;
1641 } else {
1642 arena = arena_get(tsd_tsdn(tsd), dopts->arena_ind, true);
1643 }
1644
1645 if (unlikely(dopts->alignment != 0)) {
1646 return ipalloct(tsd_tsdn(tsd), usize, dopts->alignment,
1647 dopts->zero, tcache, arena);
1648 }
1649
1650 return iallocztm(tsd_tsdn(tsd), size, ind, dopts->zero, tcache, false,
1651 arena, sopts->slow);
1652}
1653
1654JEMALLOC_ALWAYS_INLINE void *
1655imalloc_sample(static_opts_t *sopts, dynamic_opts_t *dopts, tsd_t *tsd,

Callers 2

imalloc_sampleFunction · 0.70
imalloc_bodyFunction · 0.70

Calls 6

tcache_getFunction · 0.50
tcaches_getFunction · 0.50
arena_getFunction · 0.50
tsd_tsdnFunction · 0.50
ipalloctFunction · 0.50
iallocztmFunction · 0.50

Tested by

no test coverage detected