package core.alloc
array_from_stack :: macro ($T: type_expr, size: u32) -> [] T
Allocates memory from the stack to form a slice of T
with length size
.
DO NOT USE THIS IN A LOOP! You cannot free memory allocated off the stack.
as_allocator :: macro (a: Allocator) -> unknown
as_allocator :: (rs: &Arena) -> Allocator
as_allocator :: (fa_data: &FixedAllocator) -> Allocator
as_allocator :: (rs: &RingState) -> Allocator
as_allocator :: (pool: &PoolAllocator($Elem)) -> Allocator
as_allocator :: (hs: &GCState) -> Allocator
as_allocator :: (s: &Debug_State) -> Allocator
as_allocator :: (memwatch: &MemWatchState) -> Allocator
as_allocator :: (atomic: &AtomicAllocator) -> Allocator
Overloaded procedure for converting something to an Allocator.
clear_temp_allocator :: () -> void
Resets the temporary allocator, effectively freeing all allocations made in the temporary allocator.
copy_closure :: (f: $F, a: Allocator) -> F
where type_is_function(F)
Copies the internal closure data of a function to the provided allocator, and returns the new closed function.
from_stack :: macro (size: u32) -> rawptr
Allocates memory from the stack. This is similar to alloca
in C.
DO NOT USE THIS IN A LOOP! You cannot free memory allocated off the stack.
init_temp_allocator :: () -> void
Initializes the thread-local temporary allocator.
You do not need to call this. It is called automatically on thread initialization.
on_heap :: macro (v: $V) -> &V
Moves a value on to the heap. Useful for cases like this in
f :: () -> &Foo {
return alloc.on_heap(Foo.{
name = "...",
age = 42
});
}