package core:mem/virtual

Types

Allocator_Error ¶

Allocator_Error :: runtime.Allocator_Error

Growing_Arena ¶

Growing_Arena :: struct {
	curr_block:         ^Memory_Block,
	total_used:         uint,
	total_reserved:     uint,
	minimum_block_size: uint,
	temp_count:         int,
}

Growing_Arena_Temp ¶

Growing_Arena_Temp :: struct {
	arena: ^Growing_Arena,
	block: ^Memory_Block,
	used:  uint,
}

Memory_Block ¶

Memory_Block :: struct {
	prev:      ^Memory_Block,
	base:      [^]u8,
	used:      uint,
	committed: uint,
	reserved:  uint,
}

Memory_Block_Flag ¶

Memory_Block_Flag :: enum u32 {
	Overflow_Protection, 
}

Memory_Block_Flags ¶

Memory_Block_Flags :: distinct bit_set[Memory_Block_Flag; u32]

Protect_Flag ¶

Protect_Flag :: enum u32 {
	Read, 
	Write, 
	Execute, 
}

Protect_Flags ¶

Protect_Flags :: distinct bit_set[Protect_Flag; u32]

Static_Arena ¶

Static_Arena :: struct {
	block:              ^Memory_Block,
	total_used:         uint,
	total_reserved:     uint,
	minimum_block_size: uint,
	temp_count:         int,
}

Static_Arena_Temp ¶

Static_Arena_Temp :: struct {
	arena: ^Static_Arena,
	used:  uint,
}

Constants

DEFAULT_MINIMUM_BLOCK_SIZE ¶

DEFAULT_MINIMUM_BLOCK_SIZE :: 1 << 20

Protect_No_Access ¶

Protect_No_Access :: Protect_Flags{}

STATIC_ARENA_DEFAULT_COMMIT_SIZE ¶

STATIC_ARENA_DEFAULT_COMMIT_SIZE :: 1 << 20

STATIC_ARENA_DEFAULT_RESERVE_SIZE ¶

STATIC_ARENA_DEFAULT_RESERVE_SIZE :: 1 << 30 when size_of(uintptr) == 8 else 1 << 27
 

1 GiB on 64-bit systems, 128 MiB on 32-bit systems by default

Variables

DEFAULT_PAGE_SIZE ¶

DEFAULT_PAGE_SIZE: uint = …

Procedures

alloc_from_memory_block ¶

alloc_from_memory_block :: proc "odin" (block: ^Memory_Block, min_size, alignment: int) -> (data: []u8, err: runtime.Allocator_Error) {…}

commit ¶

commit :: proc "contextless" (data: rawptr, size: uint) -> runtime.Allocator_Error {…}

decommit ¶

decommit :: proc "contextless" (data: rawptr, size: uint) {…}

growing_arena_alloc ¶

growing_arena_alloc :: proc "odin" (arena: ^Growing_Arena, min_size: int, alignment: int) -> (data: []u8, err: runtime.Allocator_Error) {…}

growing_arena_allocator ¶

growing_arena_allocator :: proc "odin" (arena: ^Growing_Arena) -> runtime.Allocator {…}

growing_arena_allocator_proc ¶

growing_arena_allocator_proc :: proc "odin" (
	allocator_data:  rawptr, 
	mode:            runtime.Allocator_Mode, 
	size, alignment: int, 
	old_memory:      rawptr, 
	old_size:        int, 
) -> ([]u8, runtime.Allocator_Error) {…}

growing_arena_bootstrap_new_by_name ¶

growing_arena_bootstrap_new_by_name :: proc "odin" ($T: typeid, $field_name: string = , minimum_block_size: uint = DEFAULT_MINIMUM_BLOCK_SIZE) -> (ptr: ^typeid, err: runtime.Allocator_Error) {…}

growing_arena_bootstrap_new_by_offset ¶

growing_arena_bootstrap_new_by_offset :: proc "odin" ($T: typeid, offset_to_arena: uintptr, minimum_block_size: uint = DEFAULT_MINIMUM_BLOCK_SIZE) -> (ptr: ^typeid, err: runtime.Allocator_Error) {…}

growing_arena_check_temp ¶

growing_arena_check_temp :: proc "odin" (arena: ^Growing_Arena, loc := #caller_location) {…}

growing_arena_destroy ¶

growing_arena_destroy :: proc "odin" (arena: ^Growing_Arena) {…}

growing_arena_free_all ¶

growing_arena_free_all :: proc "odin" (arena: ^Growing_Arena) {…}

growing_arena_free_last_memory_block ¶

growing_arena_free_last_memory_block :: proc "odin" (arena: ^Growing_Arena) {…}

growing_arena_init ¶

growing_arena_init :: proc "odin" (arena: ^Growing_Arena, reserved: uint = DEFAULT_MINIMUM_BLOCK_SIZE) -> (err: runtime.Allocator_Error) {…}

growing_arena_temp_begin ¶

growing_arena_temp_begin :: proc "odin" (arena: ^Growing_Arena) -> (temp: Growing_Arena_Temp) {…}

growing_arena_temp_end ¶

growing_arena_temp_end :: proc "odin" (temp: Growing_Arena_Temp, loc := #caller_location) {…}

memory_block_alloc ¶

memory_block_alloc :: proc "odin" (committed, reserved: uint, flags: Memory_Block_Flags) -> (block: ^Memory_Block, err: runtime.Allocator_Error) {…}

memory_block_dealloc ¶

memory_block_dealloc :: proc "odin" (block_to_free: ^Memory_Block) {…}

protect ¶

protect :: proc "contextless" (data: rawptr, size: uint, flags: Protect_Flags) -> bool {…}

release ¶

release :: proc "contextless" (data: rawptr, size: uint) {…}

reserve ¶

reserve :: proc "contextless" (size: uint) -> (data: []u8, err: runtime.Allocator_Error) {…}

reserve_and_commit ¶

reserve_and_commit :: proc "contextless" (size: uint) -> (data: []u8, err: runtime.Allocator_Error) {…}

static_arena_alloc ¶

static_arena_alloc :: proc "odin" (arena: ^Static_Arena, size: int, alignment: int) -> (data: []u8, err: runtime.Allocator_Error) {…}

static_arena_allocator ¶

static_arena_allocator :: proc "odin" (arena: ^Static_Arena) -> runtime.Allocator {…}

static_arena_allocator_proc ¶

static_arena_allocator_proc :: proc "odin" (
	allocator_data:  rawptr, 
	mode:            runtime.Allocator_Mode, 
	size, alignment: int, 
	old_memory:      rawptr, 
	old_size:        int, 
) -> ([]u8, runtime.Allocator_Error) {…}

static_arena_bootstrap_new_by_name ¶

static_arena_bootstrap_new_by_name :: proc "odin" ($T: typeid, $field_name: string = , reserved: uint) -> (ptr: ^typeid, err: runtime.Allocator_Error) {…}

static_arena_bootstrap_new_by_offset ¶

static_arena_bootstrap_new_by_offset :: proc "odin" ($T: typeid, offset_to_arena: uintptr, minimum_block_size: uint = DEFAULT_MINIMUM_BLOCK_SIZE) -> (ptr: ^typeid, err: runtime.Allocator_Error) {…}

static_arena_check_temp ¶

static_arena_check_temp :: proc "odin" (arena: ^Static_Arena, loc := #caller_location) {…}

static_arena_destroy ¶

static_arena_destroy :: proc "odin" (arena: ^Static_Arena) {…}

static_arena_free_all ¶

static_arena_free_all :: proc "odin" (arena: ^Static_Arena) {…}

static_arena_init ¶

static_arena_init :: proc "odin" (arena: ^Static_Arena, reserved: uint, commit_size: uint = STATIC_ARENA_DEFAULT_COMMIT_SIZE) -> (err: runtime.Allocator_Error) {…}

static_arena_reset_to ¶

static_arena_reset_to :: proc "odin" (arena: ^Static_Arena, pos: uint) -> bool {…}

static_arena_temp_begin ¶

static_arena_temp_begin :: proc "odin" (arena: ^Static_Arena) -> (temp: Static_Arena_Temp) {…}

static_arena_temp_end ¶

static_arena_temp_end :: proc "odin" (temp: Static_Arena_Temp, loc := #caller_location) {…}

Procedure Groups

Source Files

Generation Information

Generated with odin version dev-2022-10 (vendor "odin") Windows_amd64 @ 2022-10-05 21:11:47.461170900 +0000 UTC