How to tell which allocator I am using?

For anyone else that came here looking for an answer, see Inicola's answer on GitHub for a solution.

#![feature(alloc_system)]
#![feature(global_allocator, allocator_api)]

extern crate alloc_system;

use alloc_system::System;

#[global_allocator]
static A: System = System;

fn main() {
    let a = Box::new(4); // Allocates from the system allocator.
    println!("Hello World!, {}", a);
}

Confirmed this worked on macOS rustc 1.22.0-nightly (981ce7d8d 2017-09-03).

4 Likes