fix wrong out of memory in edge cases, just try allocate from block for one source of truth

This commit is contained in:
Laytan Laats
2025-02-12 19:09:21 +01:00
parent 4c4b481ccc
commit 7df5be2131
4 changed files with 43 additions and 12 deletions
+14
View File
@@ -31,6 +31,20 @@ test_temp_allocator_big_alloc_and_alignment :: proc(t: ^testing.T) {
testing.expect(t, err == nil)
}
@(test)
test_align_bumping_block_limit :: proc(t: ^testing.T) {
a: runtime.Arena
a.minimum_block_size = 8*mem.Megabyte
data, err := runtime.arena_alloc(&a, 4193371, 1)
testing.expect_value(t, err, nil)
testing.expect(t, len(data) == 4193371)
data, err = runtime.arena_alloc(&a, 896, 64)
testing.expect_value(t, err, nil)
testing.expect(t, len(data) == 896)
}
@(test)
test_temp_allocator_returns_correct_size :: proc(t: ^testing.T) {
arena: runtime.Arena