diff --git a/core/box/hak_alloc_api.inc.h b/core/box/hak_alloc_api.inc.h index 2ffa6d44..51622243 100644 --- a/core/box/hak_alloc_api.inc.h +++ b/core/box/hak_alloc_api.inc.h @@ -79,16 +79,20 @@ inline void* hak_alloc_at(size_t size, hak_callsite_t site) { // This prevents mixed HAKMEM/libc allocation bugs #if HAKMEM_TINY_HEADER_CLASSIDX if (!tiny_ptr && size <= TINY_MAX_SIZE) { + #if !HAKMEM_BUILD_RELEASE // Tiny failed - log and continue to Mid/ACE (no early return!) static int log_count = 0; if (log_count < 3) { fprintf(stderr, "[DEBUG] Phase 7: tiny_alloc(%zu) failed, trying Mid/ACE layers (no malloc fallback)\n", size); log_count++; } + #endif // Continue to Mid allocation below (do NOT fallback to malloc!) } #else + #if !HAKMEM_BUILD_RELEASE static int log_count = 0; if (log_count < 3) { fprintf(stderr, "[DEBUG] tiny_alloc(%zu) returned NULL, falling back\n", size); log_count++; } + #endif #endif } diff --git a/core/hakmem_tiny.c b/core/hakmem_tiny.c index 77e32d8d..98d7c8a7 100644 --- a/core/hakmem_tiny.c +++ b/core/hakmem_tiny.c @@ -1795,16 +1795,20 @@ TinySlab* hak_tiny_owner_slab(void* ptr) { } #endif + #if !HAKMEM_BUILD_RELEASE if (call_num > 14250 && call_num < 14280 && size <= 1024) { fprintf(stderr, "[HAK_TINY_ALLOC_FAST_WRAPPER] call=%lu size=%zu\n", call_num, size); fflush(stderr); } + #endif // Diagnostic removed - use HAKMEM_TINY_FRONT_DIAG in tiny_alloc_fast_pop if needed void* result = tiny_alloc_fast(size); + #if !HAKMEM_BUILD_RELEASE if (call_num > 14250 && call_num < 14280 && size <= 1024) { fprintf(stderr, "[HAK_TINY_ALLOC_FAST_WRAPPER] call=%lu returned %p\n", call_num, result); fflush(stderr); } + #endif return result; }