MCPcopy Create free account
hub / github.com/beefytech/Beef / ifree

Function ifree

BeefRT/JEMalloc/src/jemalloc.c:2863–2897  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2861}
2862
2863JEMALLOC_ALWAYS_INLINE void
2864ifree(tsd_t *tsd, void *ptr, tcache_t *tcache, bool slow_path) {
2865 if (!slow_path) {
2866 tsd_assert_fast(tsd);
2867 }
2868 check_entry_exit_locking(tsd_tsdn(tsd));
2869 if (tsd_reentrancy_level_get(tsd) != 0) {
2870 assert(slow_path);
2871 }
2872
2873 assert(ptr != NULL);
2874 assert(malloc_initialized() || IS_INITIALIZER);
2875
2876 emap_alloc_ctx_t alloc_ctx;
2877 emap_alloc_ctx_lookup(tsd_tsdn(tsd), &arena_emap_global, ptr,
2878 &alloc_ctx);
2879 assert(alloc_ctx.szind != SC_NSIZES);
2880
2881 size_t usize = sz_index2size(alloc_ctx.szind);
2882 if (config_prof && opt_prof) {
2883 prof_free(tsd, ptr, usize, &alloc_ctx);
2884 }
2885
2886 if (likely(!slow_path)) {
2887 idalloctm(tsd_tsdn(tsd), ptr, tcache, &alloc_ctx, false,
2888 false);
2889 } else {
2890 if (config_fill && slow_path && opt_junk_free) {
2891 junk_free_callback(ptr, usize);
2892 }
2893 idalloctm(tsd_tsdn(tsd), ptr, tcache, &alloc_ctx, false,
2894 true);
2895 }
2896 thread_dalloc_event(tsd, usize);
2897}
2898
2899JEMALLOC_ALWAYS_INLINE bool
2900maybe_check_alloc_ctx(tsd_t *tsd, void *ptr, emap_alloc_ctx_t *alloc_ctx) {

Callers 3

free_defaultFunction · 0.85
do_realloc_nonnull_zeroFunction · 0.85
je_dallocxFunction · 0.85

Calls 9

tsd_assert_fastFunction · 0.85
check_entry_exit_lockingFunction · 0.85
tsd_tsdnFunction · 0.85
malloc_initializedFunction · 0.85
emap_alloc_ctx_lookupFunction · 0.85
sz_index2sizeFunction · 0.85
prof_freeFunction · 0.85
idalloctmFunction · 0.85
thread_dalloc_eventFunction · 0.85

Tested by

no test coverage detected