| 2992 | } |
| 2993 | |
| 2994 | JEMALLOC_NOINLINE |
| 2995 | void |
| 2996 | free_default(void *ptr) { |
| 2997 | UTRACE(ptr, 0, 0); |
| 2998 | if (likely(ptr != NULL)) { |
| 2999 | /* |
| 3000 | * We avoid setting up tsd fully (e.g. tcache, arena binding) |
| 3001 | * based on only free() calls -- other activities trigger the |
| 3002 | * minimal to full transition. This is because free() may |
| 3003 | * happen during thread shutdown after tls deallocation: if a |
| 3004 | * thread never had any malloc activities until then, a |
| 3005 | * fully-setup tsd won't be destructed properly. |
| 3006 | */ |
| 3007 | tsd_t *tsd = tsd_fetch_min(); |
| 3008 | check_entry_exit_locking(tsd_tsdn(tsd)); |
| 3009 | |
| 3010 | if (likely(tsd_fast(tsd))) { |
| 3011 | tcache_t *tcache = tcache_get_from_ind(tsd, |
| 3012 | TCACHE_IND_AUTOMATIC, /* slow */ false, |
| 3013 | /* is_alloc */ false); |
| 3014 | ifree(tsd, ptr, tcache, /* slow */ false); |
| 3015 | } else { |
| 3016 | tcache_t *tcache = tcache_get_from_ind(tsd, |
| 3017 | TCACHE_IND_AUTOMATIC, /* slow */ true, |
| 3018 | /* is_alloc */ false); |
| 3019 | uintptr_t args_raw[3] = {(uintptr_t)ptr}; |
| 3020 | hook_invoke_dalloc(hook_dalloc_free, ptr, args_raw); |
| 3021 | ifree(tsd, ptr, tcache, /* slow */ true); |
| 3022 | } |
| 3023 | |
| 3024 | check_entry_exit_locking(tsd_tsdn(tsd)); |
| 3025 | } |
| 3026 | } |
| 3027 | |
| 3028 | JEMALLOC_ALWAYS_INLINE bool |
| 3029 | free_fastpath_nonfast_aligned(void *ptr, bool check_prof) { |
no test coverage detected