The Rust Allocator API Is Stable: Custom Allocators for Vec and Box
Rust 1.100 stabilizes the Allocator trait, so a Vec or Box can take its own allocator. When to use it, when #[global_allocator] is still right, and what is not done yet.

What does the stable Rust Allocator API let me do?
Since Rust 1.100, a library can implement the std::alloc::Allocator trait and hand that allocator to a single Vec or Box with Vec::new_in or Box::new_in. One collection gets its own memory strategy, such as an arena or a counter, while #[global_allocator] still sets the default for the whole program.
Until this month, a Rust program on the stable toolchain had one allocator. You could replace it with #[global_allocator], and plenty of teams do, but every Vec, Box and String in the binary drew from that same heap. If one hot loop wanted an arena, or one parser needed a hard ceiling on its memory, the tools for saying so lived on nightly.
Rust 1.100.0, released on November 12, 2026, changes that for the two types that matter most. The release post says it brings "the stabilization of the core parts of allocator_api, enabling library authors to define custom allocators that can be used together with certain standard library types, currently Vec and Box." It also says plainly that a lot remains to be done.
This note is for builders in the Memory band. It covers what the Rust Allocator API now lets you write, when the global allocator is still the right seam, and where a crate like rusty_alloc fits.
What the Rust Allocator API stabilized in 1.100
The center of the release is one trait, std::alloc::Allocator. It has two required methods, allocate and deallocate, both described by a Layout of size and alignment. It provides allocate_zeroed, grow, grow_zeroed and shrink with default bodies, so a minimal custom allocator writes two functions and inherits the rest.
The collections side is just as small. Vec gains new_in and with_capacity_in, both marked stable since 1.100.0 in the Vec documentation, and Box gains new_in. Each takes an allocator value, and the allocator becomes part of the type: a Vec<u32, Arena> is a different type from a Vec<u32>. That is a feature. The compiler will not let a block allocated from one allocator be freed into another by accident.
The trait is unsafe to implement, and its documentation explains why in careful detail. An allocator promises that a block it returns stays valid until it is deallocated, or until the allocator itself is dropped or mutated. The docs define when two allocators are equivalent and may free each other's blocks. They also note one difference from the older trait: Allocator allows zero-sized allocations, where the global allocator interface does not. None of this is new design. What is new is that the Rust Allocator API is something a stable crate can depend on.
Global allocator or Allocator trait: choosing the seam
The two interfaces answer different questions. The global allocator answers "which heap does this program use?" The Allocator trait answers "where should this one value get its memory?" Most projects need the first. Some will now want both.
GlobalAlloc still sets the default for the whole program
GlobalAlloc has not changed. You register one implementation with #[global_allocator], and the standard library's allocations go through it unless a value was given its own allocator. This is how rusty_alloc is used. Its README puts it directly: Rust deliverables reach the allocator through GlobalAlloc, and the quick start is two lines.
#[global_allocator]
static ALLOC: rusty_alloc_api::RustyAlloc = rusty_alloc_api::RustyAlloc;
If your goal is a faster or safer heap for everything, this is still the seam. The stable Allocator trait does not replace it, and the rusty_alloc_default note covers the wiring for teams that want the choice made once, in one place.
The Allocator trait gives one value its own memory
A custom allocator earns its place when one part of a program has a different memory story from the rest. A game frame that allocates thousands of small objects and throws them all away at once fits an arena. The game memory allocator note measured what a whole-program allocator swap does to frame spikes on a real title; a per-frame arena is the finer tool the trait now allows. A parser reading untrusted input fits a budget that refuses to grow past a cap, the argument made in resource limits before allocation. A test that wants to count bytes fits a wrapper around the system allocator.
In each case the rest of the program keeps the global heap. Only the values built with new_in take the custom path, and their types say so.
A counting allocator for one Vec
Here is the smallest useful custom allocator: it counts the bytes one collection requests, then defers to the system heap.
use std::alloc::{AllocError, Allocator, Layout, System};
use std::cell::Cell;
use std::ptr::NonNull;
struct Counting<'a> {
bytes: &'a Cell<usize>,
}
unsafe impl Allocator for Counting<'_> {
fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError> {
self.bytes.set(self.bytes.get() + layout.size());
System.allocate(layout)
}
unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout) {
// SAFETY: every block was handed out by System.allocate above.
unsafe { System.deallocate(ptr, layout) }
}
}
fn main() {
let bytes = Cell::new(0);
let mut frame: Vec<u32, Counting> = Vec::new_in(Counting { bytes: &bytes });
frame.extend(0..1_000);
let boxed = Box::new_in(7u64, Counting { bytes: &bytes });
println!("{} {} {}", frame.len(), *boxed, bytes.get());
}
We compiled and ran this with stable rustc 1.100.0 on November 16, 2026, with no feature flags. It printed 1000 7 4008: four thousand bytes for the vector and eight for the box. The borrow in Counting<'a> also shows the lifetime rule from the docs at work: the vector cannot outlive the counter it reports to.
Where the Rust Allocator API stops today
A stable trait is a floor, not a finished building. Three edges are worth knowing before you design around it.
Only Vec and Box take a custom allocator on stable
The release post names Vec and Box and no other standard type. A String, a HashMap or an Rc built on stable still uses the global allocator. The same post says that expanding the API surface and stabilizing custom allocators on more collections and pointer types is the remaining work of the Allocators 1.0 goal. Write code against what shipped, and keep the other types on the global heap until their _in constructors are stable.
An unsafe trait is a promise you have to keep
The Rust Allocator API moves memory decisions into library code, and with them, memory bugs. A custom allocator that hands out overlapping blocks, or frees into the wrong pool, breaks the guarantees safe Rust relies on. Read the trait's rules on currently allocated and invalidated blocks before writing one. Keep unsafe small and documented, and test under Miri, the way rusty_alloc's README describes its own allocator: Miri-clean, with every unsafe block documented.
Where Remade stands on the Allocator API
rusty_alloc is a pure-Rust global allocator, and its repo landing carries the conversion pin. This note does not claim that rusty_alloc implements the new Allocator trait today. Its README lists first-class heaps and arenas inside the allocator core, which are natural candidates for a per-value interface, but that is a design direction, not a shipped API. MATA Network is one deployment: the rusty_alloc page on mata.network describes MATA installing it as the workspace global allocator across its product binaries. The In The Wild note tells the rest of that story. Pick the global heap for the program, a custom allocator for the values that need one, and keep both in memory-safe Rust.
FAQ
Quick answers for builders evaluating this technology.
Which Rust version stabilized the Allocator API?
Rust 1.100.0, released November 12, 2026. The release post says the core parts of allocator_api are stable and usable with Vec and Box today, as the foundation of the Allocators 1.0 project goal, with more collections and pointer types still to come.
What is the difference between GlobalAlloc and the Allocator trait?
GlobalAlloc is registered once with #[global_allocator] and serves the standard library's allocations across the program. Allocator is handed to one value, such as a Vec, through new_in. The standard docs also note that Allocator allows zero-sized allocations, unlike GlobalAlloc.
Can String or HashMap use a custom allocator on stable Rust?
Not from this release. The Rust 1.100 announcement names Vec and Box as the standard library types that currently accept a custom allocator, and says stabilizing their use on more collections and pointer types is work still to be done.
Does rusty_alloc implement the new Allocator trait?
This note does not claim it does. The rusty_alloc README documents the crate as a GlobalAlloc that you register with #[global_allocator], which is how Rust programs reach it today. Check the repository before building on any other interface.
Is writing a custom allocator unsafe in Rust?
Implementing it is. Allocator is an unsafe trait, so the implementer promises that the memory blocks it returns follow the rules in the standard library documentation. Calling Vec::new_in with a correct allocator is ordinary safe code.