Re:Untangling Lifetimes: The Arena Allocator
by creata on Monday October 31, 2022 @08:13AM
(#33404672)
You can of course use arenas in Rust just like in C. I think the parent was talking about support for using arenas as the memory for stuff like built-in containers (dynamic arrays, hash maps, etc.):
Re:Untangling Lifetimes: The Arena Allocator
by williamcotton on Monday October 31, 2022 @09:25AM
(#33405376)
Thank you! Yeah, something like bumpalo would work just fine right now but for the future this is a great interface:
https://docs.rs/bumpalo/latest/bumpalo/#nightly-rust-allocat...
use bumpalo::Bump;
let bump = Bump::new();
let mut v = Vec::new_in(&bump);
v.push(0);
v.push(1);
v.push(2);
I’d like to start writing new projects in Rust and I’d like to continue to use this approach to memory management!