Fix bug in temp allocator when temp memory is exhausted and allocation needs overaligned mem. #1715

This commit is contained in:
Christoffer Lerno
2024-12-25 17:56:37 +01:00
parent 7424317d03
commit 17942925f5
2 changed files with 4 additions and 1 deletions

View File

@@ -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