Skip to content
BudgetAllocatorSlotCount

BudgetAllocatorSlotCount

Description

Total slot capacity carved out of the caller’s buffer at init. Fixed for the lifetime of the allocator: subtract live allocations to get the remaining budget.

Usage example (Cross-references)

Usage examples (Cross-references)
        Allocator      *alloc    = ALLOCATOR_OF(&bp);
    
        bool ok = BudgetAllocatorSlotCount(&bp) > 0;
        for (size i = 0; ok && i < BudgetAllocatorSlotCount(&bp); i++) {
            if (!AllocatorAlloc(alloc, sizeof(Node), false))
    
        bool ok = BudgetAllocatorSlotCount(&bp) > 0;
        for (size i = 0; ok && i < BudgetAllocatorSlotCount(&bp); i++) {
            if (!AllocatorAlloc(alloc, sizeof(Node), false))
                ok = false;
Last updated on