Class MemoryPoolAssigner
- java.lang.Object
-
- org.apache.nemo.runtime.executor.data.MemoryPoolAssigner
-
@ThreadSafe public final class MemoryPoolAssigner extends java.lang.Object
The MemoryPoolAssigner assigns the memory that Nemo uses for writing data blocks from theMemoryPoolAssigner.MemoryPool
. Memory is represented in chunks of equal size. Consumers of off-heap memory acquire the memory by requesting a number ofMemoryChunk
they need. MemoryPoolAssigner currently supports allocation of off-heap memory only. MemoryChunks are allocated on-demand, but if the total allocated memory exceeds the maxOffheapMb, MemoryAllocationException is thrown and the job fails. TODO #397: Separation of JVM heap region and off-heap memory region
-
-
Constructor Summary
Constructors Constructor Description MemoryPoolAssigner(int memory, double maxOffheapRatio, int chunkSizeKb)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MemoryChunk
allocateChunk()
Returns a singleMemoryChunk
fromMemoryPoolAssigner.MemoryPool
.int
getChunkSize()
Returns the chunk size of the memory pool.void
returnChunksToPool(java.lang.Iterable<MemoryChunk> target)
Returns all the MemoryChunks in the given List of MemoryChunks.
-
-
-
Method Detail
-
allocateChunk
public MemoryChunk allocateChunk() throws MemoryAllocationException
Returns a singleMemoryChunk
fromMemoryPoolAssigner.MemoryPool
.- Returns:
- a MemoryChunk
- Throws:
MemoryAllocationException
- if fails to allocate MemoryChunk.
-
returnChunksToPool
public void returnChunksToPool(java.lang.Iterable<MemoryChunk> target)
Returns all the MemoryChunks in the given List of MemoryChunks.- Parameters:
target
- the list of MemoryChunks to be returned to the memory pool.
-
getChunkSize
public int getChunkSize()
Returns the chunk size of the memory pool.- Returns:
- the chunk size in bytes.
-
-