bump-local
A Sync + Send allocator wrapper around bumpalo using per-thread bump allocators.
Why?
bumpalo::Bump is fast but not thread-safe. This crate provides a thread-safe interface by giving each thread its own Bump instance via thread-local storage,
combining bumpalo's allocation speed with Sync + Send semantics.
This crate is useful when you need to pass a custom allocator to a library that requires Sync + Send.
If you're writing multithreaded code from scratch, consider creating per-thread allocators upfront and using them instead.
Usage
use Bump;
let mut bump = new;
let bump_clone = bump.clone;
let handle = spawn;
// Wait for thread to finish
handle.join.unwrap;
// Now safe to reset - all clones are dropped
bump.reset_all.unwrap;
Check out the examples directory for examples using rayon and bumpalo collections.
Limitations
Resetting all allocators requires exclusive access to the Bump.
This library is designed for the fork-join model, where you allocate during parallel work and reset between phases.
Future versions may add a generation-based resetting option to avoid the exclusive access requirement.
Minimum Supported Rust Version (MSRV)
This crate requires Rust 1.71.1 or later.
License
MIT OR Apache-2.0