std :: alloc::bump
Struct std::BumpAllocator
struct BumpAllocator {
&heap unsigned char base;
int owned;
unsigned long used;
unsigned long cap;
}Fields
heap-backed backing buffer
1 if BumpAllocator::new allocated base (destroy() frees it)
bytes currently allocated
total buffer capacity in bytes
Methods
An arena over an existing heap buffer of cap bytes (not freed by destroy()).
A heap-backed arena of cap bytes (destroy() frees it).
Allocate size bytes whose address is a multiple of align (any
power of two; 0 is taken as 1), padding the arena as needed. null
when the arena is exhausted or align isn't a power of two.
A no-op: an arena can't give back one block. reset() frees them all.
Reset the allocator — all previous allocations become invalid.
Return the number of bytes still available.
Free the backing buffer (only valid for heap-backed allocators from BumpAllocator::new).
= drop()