nickysielicki
For anyone skipping straight to the comments, just for context, this article is not about how to nest arena allocators in rust, it's moreso about imagining how the syntax ought to look once someone decides to pick up the work.

Say what you will about C++, but allocators are something it gets incredibly right. Bloomberg lead the effort to standardize std::pmr (derived from a similar implementation in their internal codebase), and the work and thought that went into that strongly shows. If you do it right, you end up with code that largely reads as normal C++ without any sacrifice in performance -- the allocation details are capable of mostly being embedded into the type system itself. I don't see that here in this article, and I think if Rust wants to beat C++ in this space it's going to need to try to do something similar.

I wish that there were more projects happening atop std::pmr. NVIDIA's cccl has an experimental memory_resource for CUDA memory (and their RMM library has a lot of nifty resource adapters), and it's cool to see how they're adopting this to heterogeneous compute, but there's nothing interesting in the open source world that I've seen that tries to build atop the learnings of mimalloc/glibc/etc. in terms of beating the STL pool resources. Probably, they exist but are just kept proprietary.

samatman
It's odd to me to call this a capability. We have a term for this already: dynamic bind, known as dynamic scope when it's the main scoping mechanism of a language.

That said, the mechanism seems like the right way for Rust to solve this problem, since ambient allocation is deeply baked into the language, and taming implicit globals with dynamic bind has a long history, and works fairly well.

thomasmg
I wonder how to mix multiple allocators in a safe way. Say an arena allocator and the default one. How to prevent the non-arena object points to the arena one? (The problem is: the arena could get wiped, so this pointer would be invalid.) The post is about Rust, so I was hoping this is adressed...

I'm working on my own programming language and want to support multiple allocators. Usually languages just support one OR the other, safely.