diff --git a/core/mem/allocators.odin b/core/mem/allocators.odin index fc009621b..66da12959 100644 --- a/core/mem/allocators.odin +++ b/core/mem/allocators.odin @@ -153,7 +153,7 @@ scratch_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode, s := (^Scratch_Allocator)(allocator_data) if s.data == nil { - DEFAULT_BACKING_SIZE :: 1<<22 + DEFAULT_BACKING_SIZE :: 4 * Megabyte if !(context.allocator.procedure != scratch_allocator_proc && context.allocator.data != allocator_data) { panic("cyclic initialization of the scratch allocator with itself") diff --git a/core/mem/mem.odin b/core/mem/mem.odin index f7be69adc..bc77ca287 100644 --- a/core/mem/mem.odin +++ b/core/mem/mem.odin @@ -3,11 +3,11 @@ package mem import "core:runtime" import "core:intrinsics" -Byte :: 1 -Kilobyte :: 1024 * Byte -Megabyte :: 1024 * Kilobyte -Gigabyte :: 1024 * Megabyte -Terabyte :: 1024 * Gigabyte +Byte :: runtime.Byte +Kilobyte :: runtime.Kilobyte +Megabyte :: runtime.Megabyte +Gigabyte :: runtime.Gigabyte +Terabyte :: runtime.Terabyte set :: proc "contextless" (data: rawptr, value: byte, len: int) -> rawptr { return runtime.memset(data, i32(value), len) diff --git a/core/mem/virtual/arena.odin b/core/mem/virtual/arena.odin index e901cf6f3..0ddb116fd 100644 --- a/core/mem/virtual/arena.odin +++ b/core/mem/virtual/arena.odin @@ -19,11 +19,11 @@ Arena :: struct { // 1 MiB should be enough to start with -DEFAULT_ARENA_STATIC_COMMIT_SIZE :: 1<<20 +DEFAULT_ARENA_STATIC_COMMIT_SIZE :: mem.Megabyte DEFAULT_ARENA_GROWING_MINIMUM_BLOCK_SIZE :: DEFAULT_ARENA_STATIC_COMMIT_SIZE // 1 GiB on 64-bit systems, 128 MiB on 32-bit systems by default -DEFAULT_ARENA_STATIC_RESERVE_SIZE :: 1<<30 when size_of(uintptr) == 8 else 1<<27 +DEFAULT_ARENA_STATIC_RESERVE_SIZE :: mem.Gigabyte when size_of(uintptr) == 8 else 128 * mem.Megabyte diff --git a/core/runtime/core.odin b/core/runtime/core.odin index 108609f78..a74bf4285 100644 --- a/core/runtime/core.odin +++ b/core/runtime/core.odin @@ -329,6 +329,12 @@ Allocator :: struct { data: rawptr, } +Byte :: 1 +Kilobyte :: 1024 * Byte +Megabyte :: 1024 * Kilobyte +Gigabyte :: 1024 * Megabyte +Terabyte :: 1024 * Gigabyte + // Logging stuff Logger_Level :: enum uint { diff --git a/core/runtime/default_temporary_allocator.odin b/core/runtime/default_temporary_allocator.odin index 176634ff9..b71cd103a 100644 --- a/core/runtime/default_temporary_allocator.odin +++ b/core/runtime/default_temporary_allocator.odin @@ -1,6 +1,6 @@ package runtime -DEFAULT_TEMP_ALLOCATOR_BACKING_SIZE: int : #config(DEFAULT_TEMP_ALLOCATOR_BACKING_SIZE, 1<<22) +DEFAULT_TEMP_ALLOCATOR_BACKING_SIZE: int : #config(DEFAULT_TEMP_ALLOCATOR_BACKING_SIZE, 4 * Megabyte) when ODIN_OS == .Freestanding || ODIN_OS == .JS || ODIN_DEFAULT_TO_NIL_ALLOCATOR { @@ -197,4 +197,4 @@ default_temp_allocator :: proc(allocator: ^Default_Temp_Allocator) -> Allocator procedure = default_temp_allocator_proc, data = allocator, } -} \ No newline at end of file +}