MCPcopy Create free account
hub / github.com/F-Stack/f-stack / isfree

Function isfree

app/redis-6.2.6/deps/jemalloc/src/jemalloc.c:2230–2284  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2228}
2229
2230JEMALLOC_ALWAYS_INLINE void
2231isfree(tsd_t *tsd, void *ptr, size_t usize, tcache_t *tcache, bool slow_path) {
2232 if (!slow_path) {
2233 tsd_assert_fast(tsd);
2234 }
2235 check_entry_exit_locking(tsd_tsdn(tsd));
2236 if (tsd_reentrancy_level_get(tsd) != 0) {
2237 assert(slow_path);
2238 }
2239
2240 assert(ptr != NULL);
2241 assert(malloc_initialized() || IS_INITIALIZER);
2242
2243 alloc_ctx_t alloc_ctx, *ctx;
2244 if (!config_cache_oblivious && ((uintptr_t)ptr & PAGE_MASK) != 0) {
2245 /*
2246 * When cache_oblivious is disabled and ptr is not page aligned,
2247 * the allocation was not sampled -- usize can be used to
2248 * determine szind directly.
2249 */
2250 alloc_ctx.szind = sz_size2index(usize);
2251 alloc_ctx.slab = true;
2252 ctx = &alloc_ctx;
2253 if (config_debug) {
2254 alloc_ctx_t dbg_ctx;
2255 rtree_ctx_t *rtree_ctx = tsd_rtree_ctx(tsd);
2256 rtree_szind_slab_read(tsd_tsdn(tsd), &extents_rtree,
2257 rtree_ctx, (uintptr_t)ptr, true, &dbg_ctx.szind,
2258 &dbg_ctx.slab);
2259 assert(dbg_ctx.szind == alloc_ctx.szind);
2260 assert(dbg_ctx.slab == alloc_ctx.slab);
2261 }
2262 } else if (config_prof && opt_prof) {
2263 rtree_ctx_t *rtree_ctx = tsd_rtree_ctx(tsd);
2264 rtree_szind_slab_read(tsd_tsdn(tsd), &extents_rtree, rtree_ctx,
2265 (uintptr_t)ptr, true, &alloc_ctx.szind, &alloc_ctx.slab);
2266 assert(alloc_ctx.szind == sz_size2index(usize));
2267 ctx = &alloc_ctx;
2268 } else {
2269 ctx = NULL;
2270 }
2271
2272 if (config_prof && opt_prof) {
2273 prof_free(tsd, ptr, usize, ctx);
2274 }
2275 if (config_stats) {
2276 *tsd_thread_deallocatedp_get(tsd) += usize;
2277 }
2278
2279 if (likely(!slow_path)) {
2280 isdalloct(tsd_tsdn(tsd), ptr, usize, tcache, ctx, false);
2281 } else {
2282 isdalloct(tsd_tsdn(tsd), ptr, usize, tcache, ctx, true);
2283 }
2284}
2285
2286JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
2287void JEMALLOC_NOTHROW *

Callers 1

je_sdallocxFunction · 0.85

Calls 8

tsd_assert_fastFunction · 0.85
check_entry_exit_lockingFunction · 0.85
tsd_tsdnFunction · 0.85
malloc_initializedFunction · 0.85
sz_size2indexFunction · 0.85
rtree_szind_slab_readFunction · 0.85
prof_freeFunction · 0.85
isdalloctFunction · 0.85

Tested by

no test coverage detected