Skip to content

Add MMapAllocator for SSD-backed memory-mapped data allocation#302

Draft
ibhati wants to merge 4 commits intomainfrom
ib/ssd
Draft

Add MMapAllocator for SSD-backed memory-mapped data allocation#302
ibhati wants to merge 4 commits intomainfrom
ib/ssd

Conversation

@ibhati
Copy link
Copy Markdown
Member

@ibhati ibhati commented Mar 25, 2026

Add MMapAllocator that allocates memory via mmap-backed files on a configurable path (e.g. NVMe/SSD). This enables placing secondary data structures on SSD while keeping primary data in RAM, reducing heap memory usage for large-scale vector search.

  • include/svs/core/allocator_mmap.h: MMapAllocator with configurable base path, access hints (Sequential/Random/Normal), and automatic file cleanup on deallocation.
  • tests/svs/core/test_allocator_mmap.cpp: Unit tests for allocation, deallocation, file creation, and access hint propagation.
  • tests/CMakeLists.txt: Register mmap allocator test.

Add MMapAllocator that allocates memory via mmap-backed files on a
configurable path (e.g. NVMe/SSD). This enables placing secondary
data structures on SSD while keeping primary data in RAM, reducing
heap memory usage for large-scale vector search.

- include/svs/core/allocator_mmap.h: MMapAllocator with configurable
  base path, access hints (Sequential/Random/Normal), and automatic
  file cleanup on deallocation.
- tests/svs/core/test_allocator_mmap.cpp: Unit tests for allocation,
  deallocation, file creation, and access hint propagation.
- tests/CMakeLists.txt: Register mmap allocator test.
@ibhati ibhati requested review from razdoburdin and rfsaliev and removed request for razdoburdin and rfsaliev March 25, 2026 17:41
ibhati added 3 commits March 30, 2026 08:52
- Add map_existing_at_offset() to MMapAllocationManager for read-only
  file mapping with byte offset (skips file headers)
- Add use_existing_file() one-shot override to MMapAllocator so
  allocate() maps an existing binary file instead of creating a temp file
- Propagate override fields through copy constructor
- Enables zero-copy loading of saved index data without intermediate
  allocate-copy cycles, significantly reducing memory usage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant