Crate membase

Source
Expand description

§Mod-MMap

membase is a high-performance memory mapping library designed for extreme efficiency. It provides cross-platform memory mapping with advanced features like huge page support, NUMA awareness, and SIMD-optimized operations.

§Features

  • Zero-copy memory mapping with minimal overhead
  • Cross-platform support (Linux, macOS, Windows)
  • Huge page support for improved TLB efficiency
  • NUMA-aware memory allocation
  • Prefetching optimizations for sequential access
  • Thread-safe operations with minimal synchronization
  • Comprehensive error handling with detailed diagnostics

§Example

use membase::{MmapOptions, Mmap};
use std::fs::File;
use std::io::Write;

// Create a temporary file
let mut file = tempfile::tempfile()?;
 
// Write some data to the file
file.write_all(b"Hello, Mod-MMap!")?;
file.sync_all()?;

// Create a memory map with default options
let map = unsafe { MmapOptions::new().map(&file)? };

// Access the memory map
if map.len() >= 8 {
    let value = unsafe { *(map.as_ptr() as *const u64) };
    println!("First 8 bytes as u64: {}", value);
}

Re-exports§

pub use error::Error;
pub use error::Result;
pub use mmap::Mmap;
pub use mmap::MmapMut;
pub use mmap::MmapOptions;
pub use mmap::MmapRaw;
pub use advanced::HugePageSize;
pub use advanced::NumaPolicy;
pub use advanced::PrefetchStrategy;

Modules§

advanced
Advanced memory mapping features.
columnar
Columnar database functionality built on top of the memory mapping library.
error
Error handling for memory mapping operations.
mmap
Core memory mapping functionality.
platform
Platform-specific memory mapping implementations.
utils
Utility functions for memory mapping operations.

Constants§

VERSION
Version information

Functions§

has_huge_page_support
Feature detection at runtime
has_numa_support
Check if NUMA is available on this system
has_simd_support
Check if SIMD acceleration is available