| 3545 | } |
| 3546 | |
| 3547 | JEMALLOC_NOINLINE void |
| 3548 | sdallocx_default(void *ptr, size_t size, int flags) { |
| 3549 | assert(ptr != NULL); |
| 3550 | assert(malloc_initialized() || IS_INITIALIZER); |
| 3551 | |
| 3552 | tsd_t *tsd = tsd_fetch(); |
| 3553 | bool fast = tsd_fast(tsd); |
| 3554 | size_t usize = inallocx(tsd_tsdn(tsd), size, flags); |
| 3555 | assert(usize == isalloc(tsd_tsdn(tsd), ptr)); |
| 3556 | check_entry_exit_locking(tsd_tsdn(tsd)); |
| 3557 | |
| 3558 | tcache_t *tcache; |
| 3559 | if (unlikely((flags & MALLOCX_TCACHE_MASK) != 0)) { |
| 3560 | /* Not allowed to be reentrant and specify a custom tcache. */ |
| 3561 | assert(tsd_reentrancy_level_get(tsd) == 0); |
| 3562 | if ((flags & MALLOCX_TCACHE_MASK) == MALLOCX_TCACHE_NONE) { |
| 3563 | tcache = NULL; |
| 3564 | } else { |
| 3565 | tcache = tcaches_get(tsd, MALLOCX_TCACHE_GET(flags)); |
| 3566 | } |
| 3567 | } else { |
| 3568 | if (likely(fast)) { |
| 3569 | tcache = tsd_tcachep_get(tsd); |
| 3570 | assert(tcache == tcache_get(tsd)); |
| 3571 | } else { |
| 3572 | if (likely(tsd_reentrancy_level_get(tsd) == 0)) { |
| 3573 | tcache = tcache_get(tsd); |
| 3574 | } else { |
| 3575 | tcache = NULL; |
| 3576 | } |
| 3577 | } |
| 3578 | } |
| 3579 | |
| 3580 | UTRACE(ptr, 0, 0); |
| 3581 | if (likely(fast)) { |
| 3582 | tsd_assert_fast(tsd); |
| 3583 | isfree(tsd, ptr, usize, tcache, false); |
| 3584 | } else { |
| 3585 | uintptr_t args_raw[3] = {(uintptr_t)ptr, size, flags}; |
| 3586 | hook_invoke_dalloc(hook_dalloc_sdallocx, ptr, args_raw); |
| 3587 | isfree(tsd, ptr, usize, tcache, true); |
| 3588 | } |
| 3589 | check_entry_exit_locking(tsd_tsdn(tsd)); |
| 3590 | |
| 3591 | } |
| 3592 | |
| 3593 | JEMALLOC_EXPORT void JEMALLOC_NOTHROW |
| 3594 | je_sdallocx(void *ptr, size_t size, int flags) { |
no test coverage detected