Package io.atomix.utils.memory
Interface MemoryAllocator<T extends Memory>
-
- All Known Implementing Classes:
MappedMemoryAllocator
public interface MemoryAllocator<T extends Memory>Memory allocator.Memory allocators handle allocation of memory for
Memoryobjects.- Author:
- Jordan Halterman
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Tallocate(int size)Allocates memory.Treallocate(T memory, int size)Reallocates the given memory.
-
-
-
Method Detail
-
allocate
T allocate(int size)
Allocates memory.- Parameters:
size- The count of the memory to allocate.- Returns:
- The allocated memory.
-
reallocate
T reallocate(T memory, int size)
Reallocates the given memory.When the memory is reallocated, the memory address for the given
Memoryinstance may change. The returnedMemoryinstance will contain the updated address and count.- Parameters:
memory- The memory to reallocate.size- The count to which to reallocate the given memory.- Returns:
- The reallocated memory.
-
-