Flat_Pool module

flat_pool_allocator_proc

procedureSource

The Allocator_Proc for a flat pool: use it as Allocator.{ flat_pool_allocator_proc, *pool }. Allocate and resize take memory from the pool, free does nothing.

Example
pool: Flat_Pool;
defer fini(*pool);
context.allocator = Allocator.{ flat_pool_allocator_proc, *pool };
numbers := NewArray(4, int);
assert(numbers.count == 4);

Doesn't run in the browser (skipped on wasm).

flat_pool_allocator_proc :: (
    mode: Allocator_Mode,
    requested_size: s64,
    old_size: s64,
    old_memory: *void,
    allocator_data: *void
) -> *void

Parameters

mode: Allocator_Mode
requested_size: s64
old_size: s64
old_memory: *void
allocator_data: *void

Returns

*void

See also