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

Function imalloc_no_sample

deps/jemalloc/src/jemalloc.c:1911–1951  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1909
1910/* ind is ignored if dopts->alignment > 0. */
1911JEMALLOC_ALWAYS_INLINE void *
1912imalloc_no_sample(static_opts_t *sopts, dynamic_opts_t *dopts, tsd_t *tsd,
1913 size_t size, size_t usize, szind_t ind) {
1914 tcache_t *tcache;
1915 arena_t *arena;
1916
1917 /* Fill in the tcache. */
1918 if (dopts->tcache_ind == TCACHE_IND_AUTOMATIC) {
1919 if (likely(!sopts->slow)) {
1920 /* Getting tcache ptr unconditionally. */
1921 tcache = tsd_tcachep_get(tsd);
1922 assert(tcache == tcache_get(tsd));
1923 } else {
1924 tcache = tcache_get(tsd);
1925 }
1926 } else if (dopts->tcache_ind == TCACHE_IND_NONE) {
1927 tcache = NULL;
1928 } else {
1929 tcache = tcaches_get(tsd, dopts->tcache_ind);
1930 }
1931
1932 /* Fill in the arena. */
1933 if (dopts->arena_ind == ARENA_IND_AUTOMATIC) {
1934 /*
1935 * In case of automatic arena management, we defer arena
1936 * computation until as late as we can, hoping to fill the
1937 * allocation out of the tcache.
1938 */
1939 arena = NULL;
1940 } else {
1941 arena = arena_get(tsd_tsdn(tsd), dopts->arena_ind, true);
1942 }
1943
1944 if (unlikely(dopts->alignment != 0)) {
1945 return ipalloct(tsd_tsdn(tsd), usize, dopts->alignment,
1946 dopts->zero, tcache, arena);
1947 }
1948
1949 return iallocztm(tsd_tsdn(tsd), size, ind, dopts->zero, tcache, false,
1950 arena, sopts->slow);
1951}
1952
1953JEMALLOC_ALWAYS_INLINE void *
1954imalloc_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