54 typedef void *(*allocator_impl_allocate_fn)(
struct allocator *alloc, usize size);
KB_API void * allocator_reallocate_aligned(allocator *alloc, void *original, usize new_size, usize alignment)
Rellocate aligned memory.
allocator_type
Available allocator types.
void(* allocator_impl_free_all_fn)(struct allocator *alloc)
Give all allocated memory back to the allocator.
KB_API void * allocator_reallocate(allocator *alloc, void *original, usize new_size)
Reallocate memory to unaligned block.
KB_API b8 allocator_create(allocator *alloc, allocator_type type, usize size)
Create an allocator of a specific type.
KB_API void * allocator_allocate(allocator *alloc, usize size)
Allocate unaligned memory.
KB_API void allocator_destroy(allocator *alloc)
Destroy an allocator.
void(* allocator_impl_free_fn)(struct allocator *alloc, void *mem, usize size)
Give memory back to the allocator.
KB_API void * allocator_allocate_aligned(allocator *alloc, usize size, usize alignment)
Allocate aligned memory.
KB_API void allocator_free(allocator *alloc, void *mem)
Give back memory to the allocator.
KB_API void allocator_free_all(allocator *alloc)
Reset the allocator.
struct allocator allocator
Central allocator structure.
struct allocator_impl allocator_impl
Structure holding a specific allocator type's implementation.
void(* allocator_impl_destroy_fn)(struct allocator *alloc)
Destroy the allocator.
KB_API b8 allocator_create_custom(allocator *alloc, allocator_impl_create_fn create_fn, usize size)
Create an allocator based on a custom create function.
b8(* allocator_impl_create_fn)(struct allocator *alloc, usize size)
Create a specific allocator.
void *(* allocator_impl_allocate_fn)(struct allocator *alloc, usize size)
Allocate memory.
KB_API void allocator_implementation(allocator *alloc, allocator_impl_destroy_fn destroy, allocator_impl_allocate_fn allocate, allocator_impl_free_fn free, allocator_impl_free_all_fn free_all)
Set allocator implementation.
Global typedefs and macros.
Structure holding a specific allocator type's implementation.
allocator_impl_allocate_fn allocate
Allocator's allocate implementation.
allocator_impl_free_fn free
Allocator's free implementation.
allocator_impl_destroy_fn destroy
Allocator's destroy implementation.
allocator_impl_free_all_fn free_all
Allocator's free_all implementation.
Central allocator structure.
void * state
Type specific state of the allocator.
allocator_impl impl
Type specific implementation of the allocator.