memkit 0.1.0-beta.1

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


<div align="center">

**Deterministic memory allocation for systems requiring predictable performance.**

[![Crates.io](https://img.shields.io/crates/v/memkit.svg?style=for-the-badge&color=blue)](https://crates.io/crates/memkit)
[![Docs.rs](https://img.shields.io/docsrs/memkit?style=for-the-badge&color=green)](https://docs.rs/memkit)
[![License](https://img.shields.io/crates/l/memkit?style=for-the-badge&color=orange)](https://opensource.org/licenses/MPL-2.0)
[![CI](https://img.shields.io/github/actions/workflow/status/YelenaTor/memkit/ci.yml?style=for-the-badge&label=Tests)](https://github.com/YelenaTor/memkit/actions)

</div>

---

**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.

```toml
[dependencies]
memkit = { version = "0.1.0-beta.1", features = ["sentinel"] }
```

## 🚀 Quick Start


```rust
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]https://crates.io/crates/memkit-gpu | Type-safe GPU memory management | **Beta** |
| [memkit-co]https://crates.io/crates/memkit-co | CPU↔GPU transfer coordination | **Beta** |
| [memkit-async]https://crates.io/crates/memkit-async | Async-aware backpressure & pools | **Beta** |
| [cargo-memlense]https://crates.io/crates/cargo-memlense | Static analysis linter | **Beta** |

## 🤝 License


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