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) -> unknownas_allocator :: (rs: &Arena) -> Allocatoras_allocator :: (fa_data: &FixedAllocator) -> Allocatoras_allocator :: (rs: &RingState) -> Allocatoras_allocator :: (pool: &PoolAllocator($Elem)) -> Allocatoras_allocator :: (hs: &GCState) -> Allocatoras_allocator :: (s: &Debug_State) -> Allocatoras_allocator :: (memwatch: &MemWatchState) -> Allocatoras_allocator :: (atomic: &AtomicAllocator) -> AllocatorOverloaded procedure for converting something to an Allocator.
clear_temp_allocator :: () -> voidResets 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 :: () -> voidInitializes the thread-local temporary allocator.
You do not need to call this. It is called automatically on thread initialization.
on_heap :: macro (v: $V) -> &VMoves a value on to the heap. Useful for cases like this in
f :: () -> &Foo {
return alloc.on_heap(Foo.{
name = "...",
age = 42
});
}