diff --git a/lib/std/core/allocators/temp_allocator.c3 b/lib/std/core/allocators/temp_allocator.c3 index 7b7e4b69d..6b8ac49b8 100644 --- a/lib/std/core/allocators/temp_allocator.c3 +++ b/lib/std/core/allocators/temp_allocator.c3 @@ -179,8 +179,10 @@ fn void*! TempAllocator.acquire(&self, usz size, AllocInitType init_type, usz al { mem = allocator::malloc_aligned(self.backing_allocator, total_alloc_size, alignment)!; } + void* start = mem; + mem += mem::aligned_offset(TempAllocatorPage.sizeof, alignment); page = (TempAllocatorPage*)mem - 1; - page.start = mem; + page.start = start; page.size = size | PAGE_IS_ALIGNED; } else diff --git a/releasenotes.md b/releasenotes.md index 2a8708781..77c54369c 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -20,6 +20,7 @@ - Fix CRT detection on Arch Linux. - Fix lexer allowing a trailing underscore (_) with hex and binary literals. - Fix `--list-operators` CLI command printing underscore (_) and hash (#). +- Fix bug in temp allocator when temp memory is exhausted and allocation needs overaligned mem. #1715 ### Stdlib changes - Increase BitWriter.write_bits limit up to 32 bits.