rustfs-mimalloc
High-performance mimalloc V3 global allocator for Rust.
Quick Start
[]
= "0.5.1"
use MiMalloc;
static GLOBAL: MiMalloc = MiMalloc;
Features
| Feature | Description |
|---|---|
secure |
Heap allocation encryption (MI_SECURE=4) |
debug |
mimalloc debug checks |
debug_in_debug |
Auto-enable debug in Cargo debug builds |
override |
Override system malloc/free |
local_dynamic_tls |
Use local-dynamic TLS model |
no_thp |
Disable Transparent Huge Pages |
API
Allocator
MiMalloc implements GlobalAlloc — all methods use mi_malloc_aligned for guaranteed alignment.
Stats & Options
use MiMalloc;
use mi_option_t;
let version = version; // 30500 = V3.5.0
let json = stats_json; // stats as JSON
let text = stats_print; // stats as text
let info = process_info; // ProcessInfo struct
option_set;
Threadpool Hint
set_current_thread_in_threadpool;
Call this from custom thread-pool worker threads to set mimalloc's current-thread threadpool marker.
Heap & Arena
use Heap;
let heap = new.unwrap;
unsafe
heap.delete;
MSRV
Rust 1.96.0. Rolling support window for the latest three stable Rust releases.
License
Apache-2.0.