| 2189 | } |
| 2190 | |
| 2191 | JEMALLOC_ALWAYS_INLINE void |
| 2192 | ifree(tsd_t *tsd, void *ptr, tcache_t *tcache, bool slow_path) { |
| 2193 | if (!slow_path) { |
| 2194 | tsd_assert_fast(tsd); |
| 2195 | } |
| 2196 | check_entry_exit_locking(tsd_tsdn(tsd)); |
| 2197 | if (tsd_reentrancy_level_get(tsd) != 0) { |
| 2198 | assert(slow_path); |
| 2199 | } |
| 2200 | |
| 2201 | assert(ptr != NULL); |
| 2202 | assert(malloc_initialized() || IS_INITIALIZER); |
| 2203 | |
| 2204 | alloc_ctx_t alloc_ctx; |
| 2205 | rtree_ctx_t *rtree_ctx = tsd_rtree_ctx(tsd); |
| 2206 | rtree_szind_slab_read(tsd_tsdn(tsd), &extents_rtree, rtree_ctx, |
| 2207 | (uintptr_t)ptr, true, &alloc_ctx.szind, &alloc_ctx.slab); |
| 2208 | assert(alloc_ctx.szind != NSIZES); |
| 2209 | |
| 2210 | size_t usize; |
| 2211 | if (config_prof && opt_prof) { |
| 2212 | usize = sz_index2size(alloc_ctx.szind); |
| 2213 | prof_free(tsd, ptr, usize, &alloc_ctx); |
| 2214 | } else if (config_stats) { |
| 2215 | usize = sz_index2size(alloc_ctx.szind); |
| 2216 | } |
| 2217 | if (config_stats) { |
| 2218 | *tsd_thread_deallocatedp_get(tsd) += usize; |
| 2219 | } |
| 2220 | |
| 2221 | if (likely(!slow_path)) { |
| 2222 | idalloctm(tsd_tsdn(tsd), ptr, tcache, &alloc_ctx, false, |
| 2223 | false); |
| 2224 | } else { |
| 2225 | idalloctm(tsd_tsdn(tsd), ptr, tcache, &alloc_ctx, false, |
| 2226 | true); |
| 2227 | } |
| 2228 | } |
| 2229 | |
| 2230 | JEMALLOC_ALWAYS_INLINE void |
| 2231 | isfree(tsd_t *tsd, void *ptr, size_t usize, tcache_t *tcache, bool slow_path) { |
no test coverage detected