mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 23:28:48 +00:00
Use fetch_add rather than +=
This commit is contained in:
@@ -165,11 +165,11 @@ gb_internal void platform_virtual_memory_protect(void *memory, isize size);
|
|||||||
gb_printf_err("Total Usage: %lld bytes\n", cast(long long)global_platform_memory_total_usage);
|
gb_printf_err("Total Usage: %lld bytes\n", cast(long long)global_platform_memory_total_usage);
|
||||||
GB_ASSERT_MSG(pmblock != nullptr, "Out of Virtual Memory, oh no...");
|
GB_ASSERT_MSG(pmblock != nullptr, "Out of Virtual Memory, oh no...");
|
||||||
}
|
}
|
||||||
global_platform_memory_total_usage += total_size;
|
global_platform_memory_total_usage.fetch_add(total_size);
|
||||||
return pmblock;
|
return pmblock;
|
||||||
}
|
}
|
||||||
gb_internal void platform_virtual_memory_free(PlatformMemoryBlock *block) {
|
gb_internal void platform_virtual_memory_free(PlatformMemoryBlock *block) {
|
||||||
global_platform_memory_total_usage -= block->total_size;
|
global_platform_memory_total_usage.fetch_sub(block->total_size);
|
||||||
GB_ASSERT(VirtualFree(block, 0, MEM_RELEASE));
|
GB_ASSERT(VirtualFree(block, 0, MEM_RELEASE));
|
||||||
}
|
}
|
||||||
gb_internal void platform_virtual_memory_protect(void *memory, isize size) {
|
gb_internal void platform_virtual_memory_protect(void *memory, isize size) {
|
||||||
|
|||||||
+1
-1
@@ -72,7 +72,7 @@ gb_internal Ast *alloc_ast_node(AstFile *f, AstKind kind) {
|
|||||||
node->kind = kind;
|
node->kind = kind;
|
||||||
node->file_id = f ? f->id : 0;
|
node->file_id = f ? f->id : 0;
|
||||||
|
|
||||||
global_total_node_memory_allocated += size;
|
global_total_node_memory_allocated.fetch_add(size);
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user