2 releases
0.1.6 | Mar 26, 2025 |
---|---|
0.1.5 | Mar 25, 2025 |
#271 in Concurrency
212 downloads per month
46KB
977 lines
The arena, a fast, thread-safe but limited type of allocator.
Arenas are a type of allocator that destroy the objects within, all at once, once the arena itself is destroyed. They do not support deallocation of individual objects while the arena itself is still alive. The benefit of an arena is very fast allocation; just a pointer bump.
This crate implements several kinds of arena.
Features
std-reentrant-lock
: Use unstablestd::sync::ReentrantLock
. Requires nightly Rust.lock_api
: Uselock_api
crate for reentrant mutex. Requireslock_api
crate.remutex
: Useremutex
crate for reentrant mutex. Requiresremutex
crate.
Synchronized Arena
This is a simple implementation of a synchronized arena, which is a data structure that allows multiple threads to concurrently insert elements. The arena is implemented as a linked list of blocks, where each block contains a fixed number of elements. The arena is synchronized using a single reentrant mutex.
Dependencies
~120KB