Expand description
Safe Rust-native surface of rusty_alloc (plan §5.14).
From M2, RustyAlloc is a real core::alloc::GlobalAlloc:
ⓘ
#[global_allocator]
static ALLOC: rusty_alloc_api::RustyAlloc = rusty_alloc_api::RustyAlloc;Heap is a first-class heap. With the allocator-api feature (Rust
1.100 and later) both it and RustyAlloc implement
core::alloc::Allocator, so Vec::new_in(&heap) and
Box::new_in(x, RustyAlloc) work; the allocator module’s docs go through
the trait’s contract clause by clause. This crate stays a thin veneer over
the same internals as the C ABI — no separate code path, so corpus numbers
speak for Rust users too.
Structs§
- Heap
- A first-class heap (plan §5.14):
Droprunsmi_heap_deletesemantics (blocks migrate to the thread’s backing heap and stay valid) unless built withHeap::new_destroyable, whereDropreleases every block at once. The destroyable form inherits C’s contract for the raw methods below: callers must not touch its blocks after drop. With theallocator-apifeature that is unrepresentable in safe code: a collection made withVec::new_in(&heap)borrows the heap and cannot outlive it. - Rusty
Alloc - The global allocator handle (zero-sized).
Constants§
- MI_
COMPAT_ VERSION - The mimalloc version we are API- and ABI-compatible with, in mimalloc’s
encoding (major·10⁴ + minor·10² + patch): v2.4.5.
mi_version()reports this. - VERSION
- Our own semantic version, from the crate manifest.
Functions§
- version
- mimalloc-encoded compat version, as reported by the C ABI
mi_version().