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

Function je_sdallocx

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

Source from the content-addressed store, hash-verified

2976}
2977
2978JEMALLOC_EXPORT void JEMALLOC_NOTHROW
2979je_sdallocx(void *ptr, size_t size, int flags) {
2980 assert(ptr != NULL);
2981 assert(malloc_initialized() || IS_INITIALIZER);
2982
2983 LOG("core.sdallocx.entry", "ptr: %p, size: %zu, flags: %d", ptr,
2984 size, flags);
2985
2986 tsd_t *tsd = tsd_fetch();
2987 bool fast = tsd_fast(tsd);
2988 size_t usize = inallocx(tsd_tsdn(tsd), size, flags);
2989 assert(usize == isalloc(tsd_tsdn(tsd), ptr));
2990 check_entry_exit_locking(tsd_tsdn(tsd));
2991
2992 tcache_t *tcache;
2993 if (unlikely((flags & MALLOCX_TCACHE_MASK) != 0)) {
2994 /* Not allowed to be reentrant and specify a custom tcache. */
2995 assert(tsd_reentrancy_level_get(tsd) == 0);
2996 if ((flags & MALLOCX_TCACHE_MASK) == MALLOCX_TCACHE_NONE) {
2997 tcache = NULL;
2998 } else {
2999 tcache = tcaches_get(tsd, MALLOCX_TCACHE_GET(flags));
3000 }
3001 } else {
3002 if (likely(fast)) {
3003 tcache = tsd_tcachep_get(tsd);
3004 assert(tcache == tcache_get(tsd));
3005 } else {
3006 if (likely(tsd_reentrancy_level_get(tsd) == 0)) {
3007 tcache = tcache_get(tsd);
3008 } else {
3009 tcache = NULL;
3010 }
3011 }
3012 }
3013
3014 UTRACE(ptr, 0, 0);
3015 if (likely(fast)) {
3016 tsd_assert_fast(tsd);
3017 isfree(tsd, ptr, usize, tcache, false);
3018 } else {
3019 isfree(tsd, ptr, usize, tcache, true);
3020 }
3021 check_entry_exit_locking(tsd_tsdn(tsd));
3022
3023 LOG("core.sdallocx.exit", "");
3024}
3025
3026JEMALLOC_EXPORT size_t JEMALLOC_NOTHROW
3027JEMALLOC_ATTR(pure)

Callers 2

operator deleteFunction · 0.85
operator delete[]Function · 0.85

Calls 11

malloc_initializedFunction · 0.85
tsd_fetchFunction · 0.85
tsd_fastFunction · 0.85
inallocxFunction · 0.85
tsd_tsdnFunction · 0.85
isallocFunction · 0.85
check_entry_exit_lockingFunction · 0.85
tcaches_getFunction · 0.85
tcache_getFunction · 0.85
tsd_assert_fastFunction · 0.85
isfreeFunction · 0.85

Tested by

no test coverage detected