Fix mid free routing and relax mid W_MAX
This commit is contained in:
@ -106,6 +106,14 @@ inline void* hak_alloc_at(size_t size, hak_callsite_t site) {
|
||||
|
||||
hkm_size_hist_record(size);
|
||||
|
||||
// Legacy Mid MT allocator (Phase 5) is disabled by default to favor ACE/Pool.
|
||||
// Enable via HAKMEM_MID_MT_ENABLE=1 when running legacy benchmarks.
|
||||
static int g_mid_mt_enabled = -1;
|
||||
if (__builtin_expect(g_mid_mt_enabled < 0, 0)) {
|
||||
const char* e = getenv("HAKMEM_MID_MT_ENABLE");
|
||||
g_mid_mt_enabled = (e && *e && *e != '0') ? 1 : 0;
|
||||
}
|
||||
|
||||
#ifdef HAKMEM_POOL_TLS_PHASE1
|
||||
// Phase 1: Ultra-fast Pool TLS for 8KB-52KB range
|
||||
if (size >= 8192 && size <= 53248) {
|
||||
@ -116,7 +124,7 @@ inline void* hak_alloc_at(size_t size, hak_callsite_t site) {
|
||||
}
|
||||
#endif
|
||||
|
||||
if (__builtin_expect(mid_is_in_range(size), 0)) {
|
||||
if (__builtin_expect(g_mid_mt_enabled && mid_is_in_range(size), 0)) {
|
||||
#if HAKMEM_DEBUG_TIMING
|
||||
HKM_TIME_START(t_mid);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user