stack-arena
A fast, stack-like arena allocator inspired by GNU obstack, implemented in Rust.
Features
- Efficient allocation of variable-sized objects with minimal overhead.
- Objects are allocated in contiguous memory chunks.
- Stack-like (LIFO) allocation and deallocation.
- No per-object deallocation: free all objects at once or roll back to a checkpoint.
- Suitable for parsers, interpreters, and other high-performance scenarios.
Usage
Add to your Cargo.toml:
[]
= "0.1"
Example:
use SimpleObstack;
Safety
- All returned pointers or references are valid as long as the arena is not cleared or reset.
- Objects are always stored contiguously in a single chunk.
License
MIT
Acknowledgements
Inspired by GNU obstack.