Module mmap

Module mmap 

Source
Expand description

Memory-Mapped File Serving

Provides zero-copy file serving using memory-mapped I/O for improved performance with large tensor files. This module enables efficient serving of tensors without loading the entire file into memory.

§Features

  • Zero-copy serving - Direct memory mapping without buffer allocation
  • Lazy loading - Map files only when accessed
  • Range request support - Efficient partial file serving
  • Platform optimizations - Uses OS-level optimizations (sendfile, etc.)

§Safety

Memory mapping is inherently unsafe as it involves raw pointer access. This module provides a safe wrapper that ensures proper lifetime management and error handling.

Structs§

MmapCache
A simple cache for memory-mapped files
MmapConfig
Platform-specific optimization hints
MmapFile
A handle to a memory-mapped file

Enums§

MmapError
Errors that can occur during memory-mapped operations