| 2767 | } |
| 2768 | |
| 2769 | JEMALLOC_NOINLINE |
| 2770 | void |
| 2771 | free_default(void *ptr) { |
| 2772 | UTRACE(ptr, 0, 0); |
| 2773 | if (likely(ptr != NULL)) { |
| 2774 | /* |
| 2775 | * We avoid setting up tsd fully (e.g. tcache, arena binding) |
| 2776 | * based on only free() calls -- other activities trigger the |
| 2777 | * minimal to full transition. This is because free() may |
| 2778 | * happen during thread shutdown after tls deallocation: if a |
| 2779 | * thread never had any malloc activities until then, a |
| 2780 | * fully-setup tsd won't be destructed properly. |
| 2781 | */ |
| 2782 | tsd_t *tsd = tsd_fetch_min(); |
| 2783 | check_entry_exit_locking(tsd_tsdn(tsd)); |
| 2784 | |
| 2785 | tcache_t *tcache; |
| 2786 | if (likely(tsd_fast(tsd))) { |
| 2787 | tsd_assert_fast(tsd); |
| 2788 | /* Unconditionally get tcache ptr on fast path. */ |
| 2789 | tcache = tsd_tcachep_get(tsd); |
| 2790 | ifree(tsd, ptr, tcache, false); |
| 2791 | } else { |
| 2792 | if (likely(tsd_reentrancy_level_get(tsd) == 0)) { |
| 2793 | tcache = tcache_get(tsd); |
| 2794 | } else { |
| 2795 | tcache = NULL; |
| 2796 | } |
| 2797 | uintptr_t args_raw[3] = {(uintptr_t)ptr}; |
| 2798 | hook_invoke_dalloc(hook_dalloc_free, ptr, args_raw); |
| 2799 | ifree(tsd, ptr, tcache, true); |
| 2800 | } |
| 2801 | check_entry_exit_locking(tsd_tsdn(tsd)); |
| 2802 | } |
| 2803 | } |
| 2804 | |
| 2805 | JEMALLOC_ALWAYS_INLINE |
| 2806 | bool free_fastpath(void *ptr, size_t size, bool size_hint) { |
no test coverage detected