AllocatorAlloc_dyn
Description
Allocate memory through an allocator. Allocations honor the allocator’s configured alignment.
Parameters
| Name | Direction | Description |
|---|---|---|
self |
in,out | Allocator base used for the allocation. |
bytes |
in | Number of bytes to allocate. |
zeroed |
in | Whether the allocated region must be zero-initialized. |
Success
Returns a writable pointer to allocated memory.
Failure
Returns NULL when allocation fails or self is invalid.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Allocator.c:56:
}
void *AllocatorAlloc_dyn(Allocator *self, size bytes, i8 zeroed) {
ValidateAllocator(self);- In
Allocator.h:424:
///
#define AllocatorAlloc(self, bytes, zeroed) \
_Generic((self), HeapAllocator *: heap_allocator_allocate, PageAllocator *: page_allocator_allocate, ArenaAllocator *: arena_allocator_allocate, SlabAllocator *: slab_allocator_allocate, BudgetAllocator *: budget_allocator_allocate, DebugAllocator *: debug_allocator_allocate, Allocator *: AllocatorAlloc_dyn)( \
(self), \
(bytes), \
Last updated on