| 2696 | } |
| 2697 | |
| 2698 | JEMALLOC_NOINLINE |
| 2699 | void * |
| 2700 | malloc_default(size_t size) { |
| 2701 | void *ret; |
| 2702 | static_opts_t sopts; |
| 2703 | dynamic_opts_t dopts; |
| 2704 | |
| 2705 | /* |
| 2706 | * This variant has logging hook on exit but not on entry. It's callled |
| 2707 | * only by je_malloc, below, which emits the entry one for us (and, if |
| 2708 | * it calls us, does so only via tail call). |
| 2709 | */ |
| 2710 | |
| 2711 | static_opts_init(&sopts); |
| 2712 | dynamic_opts_init(&dopts); |
| 2713 | |
| 2714 | sopts.null_out_result_on_error = true; |
| 2715 | sopts.set_errno_on_error = true; |
| 2716 | sopts.oom_string = "<jemalloc>: Error in malloc(): out of memory\n"; |
| 2717 | |
| 2718 | dopts.result = &ret; |
| 2719 | dopts.num_items = 1; |
| 2720 | dopts.item_size = size; |
| 2721 | |
| 2722 | imalloc(&sopts, &dopts); |
| 2723 | /* |
| 2724 | * Note that this branch gets optimized away -- it immediately follows |
| 2725 | * the check on tsd_fast that sets sopts.slow. |
| 2726 | */ |
| 2727 | if (sopts.slow) { |
| 2728 | uintptr_t args[3] = {size}; |
| 2729 | hook_invoke_alloc(hook_alloc_malloc, ret, (uintptr_t)ret, args); |
| 2730 | } |
| 2731 | |
| 2732 | LOG("core.malloc.exit", "result: %p", ret); |
| 2733 | |
| 2734 | return ret; |
| 2735 | } |
| 2736 | |
| 2737 | /******************************************************************************/ |
| 2738 | /* |
no test coverage detected