diff options
| author | gingerBill <bill@gingerbill.org> | 2020-04-06 12:17:54 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2020-04-06 12:17:54 +0100 |
| commit | d0b913dad1325bde1bdb3df32c20cca273cb1c0a (patch) | |
| tree | 430ee19673b9d99162daaf08a62923b99795b462 /src/parser.cpp | |
| parent | d659e679fd934bd8e6e8b87aff30274ac52ceddf (diff) | |
Add extra internal memory analysis
Diffstat (limited to 'src/parser.cpp')
| -rw-r--r-- | src/parser.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/parser.cpp b/src/parser.cpp index 83ae9743f..937e84279 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -442,9 +442,16 @@ bool ast_node_expect(Ast *node, AstKind kind) { } +gb_global isize volatile total_allocated_node_memory = 0; +gb_global isize volatile total_subtype_node_memory_test = 0; + // NOTE(bill): And this below is why is I/we need a new language! Discriminated unions are a pain in C/C++ Ast *alloc_ast_node(AstFile *f, AstKind kind) { gbAllocator a = ast_allocator(); + + _InterlockedExchangeAdd64(&total_allocated_node_memory, gb_size_of(Ast)); + _InterlockedExchangeAdd64(&total_subtype_node_memory_test, gb_size_of(AstCommonStuff) + ast_variant_sizes[kind]); + Ast *node = gb_alloc_item(a, Ast); node->kind = kind; node->file = f; |