The state of Rust allocators in 2026: stabilised (opens external site)
View full thread · View on Hacker News
To get push notifications on iPhone or iPad, add Hack and Chat to your Home Screen: tap Share → Add to Home Screen, then open the installed app and enable push in Settings.
View full thread · View on Hacker News
I havn't published any popular rust crate. I think my crates are downloaded by me and robots only, so I don't have a lot of authority. I have no wishes to think about custom memory allocators. I don't want them. I consider those as unnecessary complexity for a niche use case, and I'm a bit annoyed that they will pollute the Rust landscape. I understand why people need them though, but I fear that Rust is going to be the next C++: a bloated programming language with features to please everyone and a lack of simplicity. It's already complex enough.
Replies (6)
I'm not saying it is a bad language as I use it since 9 years and still write new code in it.
But if you compare writing an bump allocator in c or zig vs rust, it is comically bloated. Same applies to anything like a vector or a hashmap or anything else low level.
You get a binary that is multiple megabytes if you just write a webserver on the path of least resistence.
Replies (2)
Even if that doesn't shrink I consider that a very good tradeoff for what we're getting.
Replies (2)
So everything is statically linked and only depends on linux syscall API. It is not apples to apples compared to rust but you can't practically do that in rust anyway.
Replies (1)
You don't use the standard library, the equivalent of the kernel syscall API is there (the win32 API), and you have the ecosystem of no_std libraries available.
This is the kind of work that is making Rust far easier and more productive for systems work, including even kernel development, than the bad old days of when every project was a monolith and everyone was reinventing the wheel.
Over the past several months I've been converting bcachefs to Rust, and as part of that I have a whole truckload of code that I can now release as small self contained crates that anyone can use: safe RCU, an async runtime suitable for kernel IO paths, a fully lockless implementation of Cuckoo - custom allocators getting standardized is directly pertinent because now all that code (RCU, especially) will compose much better with other people's crates.
Replies (1)
Not much of C++ is baked into the core language, most of it is just the standard library, it includes custom allocators. If you look at libboost, it has always been some kind of a trial ground for future C++ versions, with the best parts ending into the standard, and it is just a library.
Not so different from what is happening with Rust.
Replies (1)
Replies (1)
Replies (1)
Replies (1)
Replies (1)
Replies (1)
Replies (1)
If you know where there is any information on the borrow checker’s ability to check ‘under’ an allocator Id love to read about their strategy.
Replies (1)
Well, not to be rude, but Python and Go exist, you know. But if you're picking Rust (or Zig) — you will have to think about lifetimes, ownership, and allocations, that's the language's raison d'être.
> with features to please everyone and a lack of simplicity.
Like async! Compared to that barrel of worms, the new allocators are a complete non-issue. A two-functions trait, that Vec's and Box's "new_in" method use under the hood, with straightforward semantics — that's as complicated as having xmalloc()/xfree() in your C project.
Replies (1)
Custom allocators are certainly no niche use case, they are very common low level programming, from microcontrollers to audio software to video games.