diff --git a/core/front/malloc_tiny_fast.h b/core/front/malloc_tiny_fast.h index facfdddb..11338189 100644 --- a/core/front/malloc_tiny_fast.h +++ b/core/front/malloc_tiny_fast.h @@ -405,9 +405,11 @@ static inline int free_tiny_fast(void* ptr) { return 1; } - // Phase v7-4: Check Policy Box for v7 routing (before route lookup) - const SmallPolicyV7* policy = small_policy_v7_snapshot(); - if (class_idx == 6 && policy->route_kind[class_idx] == SMALL_ROUTE_V7) { + // Phase v7-5b/v7-7: Always try V7 free for supported classes (C5/C6) + // V7 returns false if ptr is not in V7 segment. + // This is necessary because Learner may switch routes dynamically, + // but pointers allocated before the switch still need V7 free. + if (SMALL_V7_CLASS_SUPPORTED(class_idx)) { if (small_heap_free_fast_v7_stub(ptr, (uint8_t)class_idx)) { FREE_PATH_STAT_INC(smallheap_v7_fast); return 1;