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

Function malloc_default

deps/jemalloc/src/jemalloc.c:2269–2302  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2267}
2268
2269JEMALLOC_NOINLINE
2270void *
2271malloc_default(size_t size) {
2272 void *ret;
2273 static_opts_t sopts;
2274 dynamic_opts_t dopts;
2275
2276 LOG("core.malloc.entry", "size: %zu", size);
2277
2278 static_opts_init(&sopts);
2279 dynamic_opts_init(&dopts);
2280
2281 sopts.null_out_result_on_error = true;
2282 sopts.set_errno_on_error = true;
2283 sopts.oom_string = "<jemalloc>: Error in malloc(): out of memory\n";
2284
2285 dopts.result = &ret;
2286 dopts.num_items = 1;
2287 dopts.item_size = size;
2288
2289 imalloc(&sopts, &dopts);
2290 /*
2291 * Note that this branch gets optimized away -- it immediately follows
2292 * the check on tsd_fast that sets sopts.slow.
2293 */
2294 if (sopts.slow) {
2295 uintptr_t args[3] = {size};
2296 hook_invoke_alloc(hook_alloc_malloc, ret, (uintptr_t)ret, args);
2297 }
2298
2299 LOG("core.malloc.exit", "result: %p", ret);
2300
2301 return ret;
2302}
2303
2304/******************************************************************************/
2305/*

Callers 1

JEMALLOC_ATTRFunction · 0.85

Calls 4

hook_invoke_allocFunction · 0.85
static_opts_initFunction · 0.70
dynamic_opts_initFunction · 0.70
imallocFunction · 0.70

Tested by

no test coverage detected