Tracking issue for rust-lang/rfcs#1183 rust-lang/rfcs#1974
Known bugs:
Current status:
A quick summary of the current state of this feature is that you can change the default global allocator via:
// Change this program's global allocator. At most one `#[global_allocator]`
// allowed in any crate graph.
#[global_allocator]
static ALLOCATOR: MyAlloc = MyAlloc;
// When defining a global allocator, the `Alloc` trait must be defined
// for `&'a T` instead of `T`
use std::heap::Alloc;
struct MyAlloc;
impl<'a> Alloc for &'a MyAlloc {
// ...
}
Tracking issue for
rust-lang/rfcs#1183rust-lang/rfcs#1974Known bugs:
#[global_allocator]attribute doesn't work in modules global_allocator can not not be defined inside module #44113Current status:
A quick summary of the current state of this feature is that you can change the default global allocator via: