Package io.atomix.utils.memory
Class MappedMemoryAllocator
java.lang.Object
io.atomix.utils.memory.MappedMemoryAllocator
- All Implemented Interfaces:
MemoryAllocator<MappedMemory>
Mapped memory allocator.
The mapped memory allocator provides direct memory access to memory mapped from a file on
disk. The mapped allocator supports allocating memory in any FileChannel.MapMode. Once
the file is mapped and the memory has been allocated, the mapped allocator provides the memory
address of the underlying MappedByteBuffer for access via Unsafe.
- Author:
- Jordan Halterman
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMappedMemoryAllocator(File file) MappedMemoryAllocator(File file, FileChannel.MapMode mode) MappedMemoryAllocator(File file, FileChannel.MapMode mode, long offset) MappedMemoryAllocator(RandomAccessFile file, FileChannel.MapMode mode, long offset) -
Method Summary
-
Field Details
-
DEFAULT_MAP_MODE
-
-
Constructor Details
-
MappedMemoryAllocator
-
MappedMemoryAllocator
-
MappedMemoryAllocator
-
MappedMemoryAllocator
-
-
Method Details
-
allocate
Description copied from interface:MemoryAllocatorAllocates memory.- Specified by:
allocatein interfaceMemoryAllocator<MappedMemory>- Parameters:
size- The count of the memory to allocate.- Returns:
- The allocated memory.
-
close
public void close()
-