- AnyList now also defaults to the temp allocator.

- `os::getcwd` and `os::get_home_dir` requires an explicit allocator.
- `file::load_new` and `file::load_path_new` removed.
This commit is contained in:
Christoffer Lerno
2025-03-18 18:34:52 +01:00
parent cfc87a9d66
commit 7e100472e7
15 changed files with 45 additions and 44 deletions

View File

@@ -9,7 +9,7 @@ enum Foo
fn void print_pages()
{
allocator::temp().print_pages(io::stdout())!!;
tmem().print_pages(io::stdout())!!;
}
fn void setstring(char* dst, String str)
@@ -63,7 +63,7 @@ fn void main()
io::printf("First big: %p\n", first_big);
print_pages();
};
mem::@scoped(allocator::temp())
mem::@scoped(tmem())
{
io::printf("Malloc: %p\n", (void*)malloc(23));
io::printf("Malloc: %p\n", (void*)malloc(23));
@@ -73,14 +73,14 @@ fn void main()
{
io::printf("Talloc: %p\n", (void*)tmalloc(22));
};
testAllocator(allocator::temp(), 126);
testAllocator(allocator::temp(), 12600);
testAllocator(tmem(), 126);
testAllocator(tmem(), 12600);
ArenaAllocator aa;
aa.init(&&char[1024] {});
testAllocator(&aa, 126);
io::printn("Test dynamic arena");
DynamicArenaAllocator dynamic_arena;
dynamic_arena.init(1024, allocator::heap());
dynamic_arena.init(mem, 1024);
testAllocator(&dynamic_arena, 112);
testAllocator(&dynamic_arena, 712);
first_big[3] = 123;