Summary
ArenaAllocator::Allocate(size_t size, size_t alignment) has no explicit assertion that alignment is a power of two before calling memory_align().
Location
ZEngine/ZEngine/Core/Memory/Allocator.cpp:60 — ArenaAllocator::Allocate
Detail
The power-of-two assertion exists inside Helpers::memory_align() (MemoryOperations.h:172):
ZENGINE_VALIDATE_ASSERT(is_power_of_two(align), "Alignment should be power of two");
And Resize() adds its own explicit assert at Allocator.cpp:112:
ZENGINE_VALIDATE_ASSERT(Helpers::is_power_of_two(alignment), "Alignment should be power of 2")
But Allocate() has no such guard at the call site. Defensive programming should assert the precondition directly in Allocate() before delegating to the helper — consistent with how Resize() handles it.
Fix
Add at the top of Allocate():
ZENGINE_VALIDATE_ASSERT(Helpers::is_power_of_two(alignment), "ArenaAllocator::Allocate: alignment must be a power of two");
Impact
Low — the assertion fires inside memory_align() regardless, so no allocation with a bad alignment succeeds silently. This is a defensive programming / consistency gap, not a silent failure.
Summary
ArenaAllocator::Allocate(size_t size, size_t alignment)has no explicit assertion thatalignmentis a power of two before callingmemory_align().Location
ZEngine/ZEngine/Core/Memory/Allocator.cpp:60—ArenaAllocator::AllocateDetail
The power-of-two assertion exists inside
Helpers::memory_align()(MemoryOperations.h:172):And
Resize()adds its own explicit assert atAllocator.cpp:112:But
Allocate()has no such guard at the call site. Defensive programming should assert the precondition directly inAllocate()before delegating to the helper — consistent with howResize()handles it.Fix
Add at the top of
Allocate():Impact
Low — the assertion fires inside
memory_align()regardless, so no allocation with a bad alignment succeeds silently. This is a defensive programming / consistency gap, not a silent failure.