Unofficial Hacker News client - receive Push Notifications on replies.

The state of Rust allocators in 2026: stabilised (opens external site)

206 points by fanf2 2 days ago | cetra3.github.io | 85 comments on HN | Vote on HN (opens Hacker News)

View full thread · View on Hacker News

Comment thread (5)

  1. >My toy kernel says otherwise. There are many stages of boot at varying levels of abstraction and being able to conveniently express each one is wonderful.

    You need tight allocation control and arena usage when squeezing the most performance possible out of your system is non-negotiable. Most people don't need to write such code.

    Replies (4)
    1. Object pools are somewhat popular. Hugely popular in game development. And they are essentially a custom allocator for languages that don't have custom allocators
    2. Even performance critical applications have non-performance critical parts.

      E.g. in the aforementioned audio programming you may do the setup, init phase normally and only go for custom allocators afterwards.

    3. It's not only about performance. It is also about embedded system that don't have much memory, and have no fallback when they are out of memory. When ending up in some untested and faulty state you'd prefer getting some logs to just panicking and rebooting.

      When the code uses dynamic allocation liberally, there is no such option: once a malloc fails you can only panic. You can reserve a piece of memory for recovery action, but it doesn't help much if recovery path engages most of the codebase. E. g. on IoT stuff most of the complexity is in the network stack - and you need the network stack if you want to get your logs.

      And yes, recursion and stack is also a problem, even if more manageable than malloc. You can avoid recursion completely, but there still a risk of stack overflow on an untested code path. Zig promised staticaly-known stack depth once, but, afaik, didn't get there.

    4. Rust is kind of targeting those users. I want Rust to cater to this usecase. It is fine not to use custom allocators if you don’t want to.