mnemosyne-memory
The public shell of Mnemosyne, a
concurrent user-space memory allocator written entirely in Rust. The library
name is mnemosyne; the crates.io package is mnemosyne-memory.
[]
= "0.9"
use Mnemosyne;
static ALLOCATOR: Mnemosyne = Mnemosyne;
What this crate provides
Mnemosyne— the global allocator, routed toStandardPolicy.MnemosyneAllocator<P: AllocPolicy>— the same allocator with a compile-time policy injected.SecurePolicyadds zero-initialization on allocation and0xDEpoisoning at the deallocation boundary; because the policy is a zero-sized type, the unused branch is eliminated at compile time.memory_stats()/backend_memory_stats()— mapping, purge, and thread-cache telemetry.configure()/get_options()— runtime tuning of segment retention and purge cadence.usable_size(ptr)— the allocator's actual reservation for a pointer, the equivalent ofmi_usable_size/malloc_usable_size.reset()/purge()— RSS reduction, with and without surrendering address space.scratch— aligned scratch lanes forf32,f64, andu8.counting—CountingAllocator<A>, aGlobalAllocwrapper that counts allocations, reallocations, deallocations, and bytes per thread, andmeasure, which returns a closure's value with the counts its thread produced, for allocation-budget tests that must not see other threads.- Branded heap re-exports (
branded_scope,BrandedBox,BrandedVec,BrandedCell) behind thebrandedfeature.
The design follows mimalloc's free-list sharding and segment/page geometry and snmalloc's message-passing cross-thread frees. See the repository README for the mechanism-to-source-paper table.
Licensed under MIT OR Apache-2.0.