Expand description
A zero-dependency bump-pointer arena allocator with RAII transactions,
nested savepoints, and ArenaVec.
§Features
- O(1) amortised allocation — bump pointer advance with a single bounds check
- Checkpoint / rewind — snapshot arena state in O(1), undo allocations
- RAII transactions — auto-rollback on drop, explicit commit via
mem::forget - Transaction budget — cap arena bytes per transaction (tracks inline sizes only; heap allocations inside values are not counted)
- Zero-cost reset — reuse all allocated blocks without OS calls
ArenaVec<T>— append-only growable vector backed by arena memory
§Quick Start
use fastarena::Arena;
let mut arena = Arena::new();
let x = arena.alloc(42u64);
let s = arena.alloc_str("hello");
arena.reset(); // zero-cost reset§Feature Flags
| Flag | Default | Description |
|---|---|---|
drop-tracking | Off | Run destructors in LIFO order on reset/rewind |
Macros§
- arenavec
- Creates an
ArenaVecbacked by the given arena.
Structs§
- Arena
- A bump-pointer arena allocator with RAII transactions, checkpoint/rewind, and zero-cost reset/reuse.
- Arena
Stats - A snapshot of arena memory usage returned by
super::allocator::Arena::stats. - Arena
Vec - An append-only growable vector backed by arena memory.
- Arena
VecInto Iter - Owning iterator over an
ArenaVec. Drains elements front-to-back and drops any remaining elements (in LIFO order) when the iterator itself is dropped. - Checkpoint
- An opaque snapshot of arena state used by
Arena::rewind. - Transaction
- A scoped RAII transaction over an
Arena. - TxnDiff
- Allocation metrics for a single transaction scope, returned by
Transaction::diff.
Enums§
- TryReserve
Error - Error returned by
ArenaVec::try_reservewhen allocation fails. - TxnStatus
- Outcome of
Transaction::commitorTransaction::rollback.