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

Function imalloc

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

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

Source from the content-addressed store, hash-verified

1923
1924/* Returns the errno-style error code of the allocation. */
1925JEMALLOC_ALWAYS_INLINE int
1926imalloc(static_opts_t *sopts, dynamic_opts_t *dopts) {
1927 if (unlikely(!malloc_initialized()) && unlikely(malloc_init())) {
1928 if (config_xmalloc && unlikely(opt_xmalloc)) {
1929 malloc_write(sopts->oom_string);
1930 abort();
1931 }
1932 UTRACE(NULL, dopts->num_items * dopts->item_size, NULL);
1933 set_errno(ENOMEM);
1934 *dopts->result = NULL;
1935
1936 return ENOMEM;
1937 }
1938
1939 /* We always need the tsd. Let's grab it right away. */
1940 tsd_t *tsd = tsd_fetch();
1941 assert(tsd);
1942 if (likely(tsd_fast(tsd))) {
1943 /* Fast and common path. */
1944 tsd_assert_fast(tsd);
1945 sopts->slow = false;
1946 return imalloc_body(sopts, dopts, tsd);
1947 } else {
1948 sopts->slow = true;
1949 return imalloc_body(sopts, dopts, tsd);
1950 }
1951}
1952/******************************************************************************/
1953/*
1954 * Begin malloc(3)-compatible functions.

Callers 2

JEMALLOC_ATTRFunction · 0.70
jemalloc.cFile · 0.70

Calls 8

malloc_initializedFunction · 0.70
malloc_initFunction · 0.70
malloc_writeFunction · 0.70
imalloc_bodyFunction · 0.70
set_errnoFunction · 0.50
tsd_fetchFunction · 0.50
tsd_fastFunction · 0.50
tsd_assert_fastFunction · 0.50

Tested by

no test coverage detected