MCPcopy Create free account
hub / github.com/beefytech/Beef / imalloc

Function imalloc

BeefRT/JEMalloc/src/jemalloc.c:2674–2696  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

2672
2673/* Returns the errno-style error code of the allocation. */
2674JEMALLOC_ALWAYS_INLINE int
2675imalloc(static_opts_t *sopts, dynamic_opts_t *dopts) {
2676 if (tsd_get_allocates() && !imalloc_init_check(sopts, dopts)) {
2677 return ENOMEM;
2678 }
2679
2680 /* We always need the tsd. Let's grab it right away. */
2681 tsd_t *tsd = tsd_fetch();
2682 assert(tsd);
2683 if (likely(tsd_fast(tsd))) {
2684 /* Fast and common path. */
2685 tsd_assert_fast(tsd);
2686 sopts->slow = false;
2687 return imalloc_body(sopts, dopts, tsd);
2688 } else {
2689 if (!tsd_get_allocates() && !imalloc_init_check(sopts, dopts)) {
2690 return ENOMEM;
2691 }
2692
2693 sopts->slow = true;
2694 return imalloc_body(sopts, dopts, tsd);
2695 }
2696}
2697
2698JEMALLOC_NOINLINE
2699void *

Calls 6

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

Tested by

no test coverage detected