rusty_alloc-api 0.7.0

Safe Rust surface for the rusty_alloc pure-Rust mimalloc remake: GlobalAlloc, first-class Heap, and the Allocator trait. No unsafe required of callers. MIT.
Documentation

rusty_alloc-api

The safe Rust surface over rusty_alloc, a pure-Rust remake of mimalloc that measures at-or-below mimalloc on instructions retired — on real programs and on every operation of the per-op scan — while detecting double frees that upstream silently accepts.

Status: 0.7.0 — a 0.x release. See the rusty_alloc crate page for the performance evidence and its scope (instruction counts, not wall-clock).

Upgrade from 0.3.x or earlier — mandatory. 0.4.0 fixed three platform-independent use-after-frees; treat 0.3.2 and earlier as unsound on every target.

What it gives you

  • GlobalAlloc — drop it in as #[global_allocator].
  • First-class heaps — create independent heaps, allocate from them, destroy them wholesale.
  • Allocator — the unstable allocator_api trait, behind a feature.
use rusty_alloc_api::RustyAlloc;

#[global_allocator]
static ALLOC: RustyAlloc = RustyAlloc;

fn main() {
    let v: Vec<u64> = (0..1000).collect();
    println!("{}", v.len());
}

Features

debug_checks, secure, profile — each forwards to the identically-named feature on rusty_alloc.

License

MIT. See LICENSE at the repository root.