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

Function irallocx_prof

BeefRT/JEMalloc/src/jemalloc.c:3463–3490  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3461}
3462
3463JEMALLOC_ALWAYS_INLINE void *
3464irallocx_prof(tsd_t *tsd, void *old_ptr, size_t old_usize, size_t size,
3465 size_t alignment, size_t usize, bool zero, tcache_t *tcache,
3466 arena_t *arena, emap_alloc_ctx_t *alloc_ctx,
3467 hook_ralloc_args_t *hook_args) {
3468 prof_info_t old_prof_info;
3469 prof_info_get_and_reset_recent(tsd, old_ptr, alloc_ctx, &old_prof_info);
3470 bool prof_active = prof_active_get_unlocked();
3471 bool sample_event = te_prof_sample_event_lookahead(tsd, usize);
3472 prof_tctx_t *tctx = prof_alloc_prep(tsd, prof_active, sample_event);
3473 void *p;
3474 if (unlikely((uintptr_t)tctx != (uintptr_t)1U)) {
3475 p = irallocx_prof_sample(tsd_tsdn(tsd), old_ptr, old_usize,
3476 usize, alignment, zero, tcache, arena, tctx, hook_args);
3477 } else {
3478 p = iralloct(tsd_tsdn(tsd), old_ptr, old_usize, size, alignment,
3479 zero, tcache, arena, hook_args);
3480 }
3481 if (unlikely(p == NULL)) {
3482 prof_alloc_rollback(tsd, tctx);
3483 return NULL;
3484 }
3485 assert(usize == isalloc(tsd_tsdn(tsd), p));
3486 prof_realloc(tsd, p, size, usize, tctx, prof_active, old_ptr,
3487 old_usize, &old_prof_info, sample_event);
3488
3489 return p;
3490}
3491
3492static void *
3493do_rallocx(void *ptr, size_t size, int flags, bool is_realloc) {

Callers 1

do_rallocxFunction · 0.85

Calls 9

prof_active_get_unlockedFunction · 0.85
irallocx_prof_sampleFunction · 0.85
tsd_tsdnFunction · 0.85
iralloctFunction · 0.85
prof_alloc_rollbackFunction · 0.85
isallocFunction · 0.85
prof_reallocFunction · 0.85

Tested by

no test coverage detected