Skip to content
AllocatorFree_dyn

AllocatorFree_dyn

Description

Free memory through an allocator.

Parameters

Name Direction Description
self in,out Allocator base that issued the original allocation.
ptr in Pointer to the allocation, or NULL.

Success

Function returns. The allocation is reclaimed.

Failure

No action is taken when ptr is NULL. A ptr that the allocator does not own / has already freed / does not point at an allocation’s base aborts via LOG_FATAL.

Usage example (Cross-references)

Usage examples (Cross-references)
    }
    
    void AllocatorFree_dyn(Allocator *self, void *ptr) {
        if (!ptr) {
            return;
    ///
    #define AllocatorFree(self, ptr)                                                                                                                                                                                                                                                                                                      \
        _Generic((self), HeapAllocator *: heap_allocator_deallocate, PageAllocator *: page_allocator_deallocate, ArenaAllocator *: arena_allocator_deallocate, SlabAllocator *: slab_allocator_deallocate, BudgetAllocator *: budget_allocator_deallocate, DebugAllocator *: debug_allocator_deallocate, Allocator *: AllocatorFree_dyn)( \
            (Allocator *)(self),                                                                                                                                                                                                                                                                                                          \
            (ptr)                                                                                                                                                                                                                                                                                                                         \
Last updated on