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)
- In
Budget.c:85:
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))- In
Budget.c:86:
bool ok = BudgetAllocatorSlotCount(&bp) > 0;
for (size i = 0; ok && i < BudgetAllocatorSlotCount(&bp); i++) {
if (!AllocatorAlloc(alloc, sizeof(Node), false))
ok = false;- In
PdbCache.c:836:
u64 buf[4] = {0}; // 32 bytes -> exactly one 16-byte slot
BudgetAllocator bp = BudgetAllocatorInit((u8 *)buf, sizeof(buf), 16);
if (BudgetAllocatorSlotCount(&bp) != 1)
return false; // precondition: the targeting needs a single slot
Last updated on