memkit 0.1.1-beta.1

Deterministic, intent-driven memory allocation for systems requiring predictable performance
Documentation

memkit

Deterministic memory allocation for systems requiring predictable performance.

Crates.io Docs.rs License CI


memkit provides intent-driven CPU memory allocation with explicit lifetimes and zero-overhead abstractions. It is designed for high-performance systems where latency spikes are unacceptable and memory behavior must be auditable.

⚡ The memkit Advantage

Feature System Monitor memkit Impact
Allocation Cost O(n) / Varies O(1) Zero latency spikes
fragmentation High over time Zero (Reset) Stable long-term uptime
Cache Locality Random Contiguous fast iteration & SIMD
Thread Safety Locks / Contention Lock-Free TLS Linear scaling
Cleanup Per-object Drop Bulk Reset Instant frame cleanup

🛡️ Sentinel Mode (New in Beta)

Enable the sentinel feature to activate debug-hardened memory verification:

  • Poisoning: Fills allocated (0xAA) and freed (0xDD) memory to catch use-after-free bugs.
  • Trace Logging: Reports allocation hazards to stderr.
  • Leak Detection: Verifies zero leaks on shutdown.
[dependencies]

memkit = { version = "0.1.1-beta.1", features = ["sentinel"] }

🚀 Quick Start

use memkit::{MkAllocator, MkConfig};

// Standard setup
let alloc = MkAllocator::new(MkConfig::default());

loop {
    alloc.begin_frame();
    
    // 1. Frame Allocation: Bump pointer, instant, dropped at end of frame
    let buffer = alloc.frame_slice::<f32>(1024).unwrap();
    
    // 2. Scoped Allocation: Temporary workspace within a frame
    {
        let _scope = alloc.scope();
        let temp = alloc.frame_box(TempData::new()).unwrap();
    } // 'temp' effectively freed here (head reset)
    
    // 3. Pool Allocation: Stable objects across frames
    let component = alloc.pool_box(Component::new()).unwrap();
    
    alloc.end_frame(); // Instant O(1) reset
}

📦 Ecosystem

Crate Purpose Status
memkit Core allocators & primitives Beta
memkit-gpu Type-safe GPU memory management Beta
memkit-co CPU↔GPU transfer coordination Beta
memkit-async Async-aware backpressure & pools Beta
cargo-memlense Static analysis linter Beta

🤝 License

Licensed under the Mozilla Public License 2.0 (MPL-2.0). See LICENSE.md for details.