Expand description
Lock-free bump (linear) allocator.
A bump allocator maintains a single monotonically-increasing offset into a fixed backing buffer. Each allocation simply advances the offset by the required (aligned) size.
§Trade-offs
| Pro | Con |
|---|---|
| O(1) allocation with zero fragmentation | No individual deallocation |
| Thread-safe without a mutex (CAS loop) | Must call [reset] to reclaim memory |
| Minimal memory overhead per allocation | Buffer size fixed at construction |
§Usage
ⓘ
static mut BUF: [u8; 4096] = [0u8; 4096];
let bump = BumpAllocator::new(unsafe { &mut BUF });
let vec: ExVec<u32> = ExVec::new(&bump);Structs§
- Bump
Allocator - A thread-safe, lock-free bump allocator backed by a static byte buffer.