Minimize memory usage by having an arena per thread rather than an arena per file

This commit is contained in:
gingerBill
2022-02-18 21:30:25 +00:00
parent cd89d8a3c4
commit 71df46456a
6 changed files with 15 additions and 15 deletions
+2 -4
View File
@@ -97,8 +97,6 @@ struct AstFile {
AstPackage * pkg;
Scope * scope;
Arena arena;
Ast * pkg_decl;
String fullpath;
Tokenizer tokenizer;
@@ -801,10 +799,10 @@ gb_inline bool is_ast_when_stmt(Ast *node) {
return node->kind == Ast_WhenStmt;
}
gb_global gb_thread_local Arena global_ast_arena = {};
gb_global gb_thread_local Arena global_thread_local_ast_arena = {};
gbAllocator ast_allocator(AstFile *f) {
Arena *arena = f ? &f->arena : &global_ast_arena;
Arena *arena = &global_thread_local_ast_arena;
return arena_allocator(arena);
}