mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 03:51:18 +00:00
- 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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user