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

Function imalloc

deps/jemalloc/src/jemalloc.c:2245–2267  ·  view source on GitHub ↗

Returns the errno-style error code of the allocation. */

Source from the content-addressed store, hash-verified

2243
2244/* Returns the errno-style error code of the allocation. */
2245JEMALLOC_ALWAYS_INLINE int
2246imalloc(static_opts_t *sopts, dynamic_opts_t *dopts) {
2247 if (tsd_get_allocates() && !imalloc_init_check(sopts, dopts)) {
2248 return ENOMEM;
2249 }
2250
2251 /* We always need the tsd. Let's grab it right away. */
2252 tsd_t *tsd = tsd_fetch();
2253 assert(tsd);
2254 if (likely(tsd_fast(tsd))) {
2255 /* Fast and common path. */
2256 tsd_assert_fast(tsd);
2257 sopts->slow = false;
2258 return imalloc_body(sopts, dopts, tsd);
2259 } else {
2260 if (!tsd_get_allocates() && !imalloc_init_check(sopts, dopts)) {
2261 return ENOMEM;
2262 }
2263
2264 sopts->slow = true;
2265 return imalloc_body(sopts, dopts, tsd);
2266 }
2267}
2268
2269JEMALLOC_NOINLINE
2270void *

Calls 6

imalloc_init_checkFunction · 0.85
imalloc_bodyFunction · 0.70
tsd_get_allocatesFunction · 0.50
tsd_fetchFunction · 0.50
tsd_fastFunction · 0.50
tsd_assert_fastFunction · 0.50

Tested by

no test coverage detected