| Crates.io | aegis-memory |
| lib.rs | aegis-memory |
| version | 0.1.7 |
| created_at | 2026-01-20 02:31:34.295357+00 |
| updated_at | 2026-01-24 03:49:15.835549+00 |
| description | Memory management for Aegis database |
| homepage | https://automatanexus.com |
| repository | https://github.com/AutomataNexus/Aegis-DB |
| max_upload_size | |
| id | 2055679 |
| size | 38,631 |
Memory management and allocation for the Aegis Database Platform.
aegis-memory provides efficient memory management primitives including arena allocators and buffer pools. It's designed for high-performance database operations where memory allocation patterns are predictable.
| Module | Description |
|---|---|
arena |
Arena-based memory allocator |
[dependencies]
aegis-memory = { path = "../aegis-memory" }
The arena allocator is ideal for request-scoped allocations where all memory can be freed at once:
use aegis_memory::arena::Arena;
// Create an arena with 1MB initial capacity
let arena = Arena::new(1024 * 1024);
// Allocate memory (very fast - just bumps a pointer)
let buffer = arena.alloc(1024);
// Use the buffer...
buffer[0] = 42;
// Reset frees all allocations at once (O(1))
arena.reset();
| Operation | Arena | Standard Allocator |
|---|---|---|
| Allocate | O(1) bump | O(log n) search |
| Deallocate | Deferred | O(log n) coalesce |
| Reset | O(1) | N/A |
Arena Memory Layout:
┌────────────────────────────────────────────┐
│ Block 1 │
│ ┌─────────┬─────────┬─────────┬──────────┐│
│ │ Alloc 1 │ Alloc 2 │ Alloc 3 │ Free ││
│ └─────────┴─────────┴─────────┴──────────┘│
├────────────────────────────────────────────┤
│ Block 2 (allocated when Block 1 full) │
│ ┌─────────┬──────────────────────────────┐│
│ │ Alloc 4 │ Free ││
│ └─────────┴──────────────────────────────┘│
└────────────────────────────────────────────┘
Run benchmarks:
cargo bench -p aegis-memory
Typical results:
cargo test -p aegis-memory
Test count: 5 tests
Apache-2.0