pub enum AllocatorType {
MimallocSecure,
Mimalloc,
EmbeddedHeap,
System,
}
Expand description
Memory allocator type enumeration
Represents all memory allocator types supported by auto-allocator. Selection priority: mimalloc > embedded > system
§Performance Characteristics
AllocatorType::MimallocSecure
- Microsoft-developed allocator with security hardening (10% overhead)AllocatorType::Mimalloc
- Microsoft-developed allocator, optimal multi-threaded performanceAllocatorType::EmbeddedHeap
- Lightweight allocator for resource-constrained environmentsAllocatorType::System
- Operating system default allocator, maximum compatibility
§Automatic Selection Logic
- Modern Linux: mimalloc (if GCC 4.9+ and stdatomic.h available)
- Legacy Linux: Compilation error with upgrade guidance
- Windows/macOS: mimalloc (always available)
- Mobile/BSD: System allocators (platform compliance)
- Embedded (
target_os = "none"
): embedded-alloc (all no_std architectures)
§Example
use auto_allocator;
let info = auto_allocator::get_allocator_info();
match info.allocator_type {
auto_allocator::AllocatorType::Mimalloc => {
println!("Using mimalloc - optimal performance");
}
auto_allocator::AllocatorType::System => {
println!("Using system allocator - platform compliance");
}
_ => println!("Using other allocator"),
}
Variants§
MimallocSecure
Security-hardened mimalloc allocator
Microsoft-developed allocator with enhanced security features.
~10% performance overhead for comprehensive heap protection.
Available when secure
feature is enabled on compatible platforms.
Mimalloc
High-performance mimalloc allocator
Microsoft-developed allocator optimized for multi-threaded workloads. Automatically selected on modern systems with GCC 4.9+ and stdatomic.h.
EmbeddedHeap
Embedded systems allocator
Lightweight allocator designed for resource-constrained environments. Automatically selected on embedded architectures.
System
System default allocator
Operating system provided allocator, maximum compatibility. Selected for debug builds, WASM, mobile, and platforms with optimized native allocators.
Trait Implementations§
Source§impl Clone for AllocatorType
impl Clone for AllocatorType
Source§fn clone(&self) -> AllocatorType
fn clone(&self) -> AllocatorType
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read more