MemoryConsumer¶
MemoryConsumer is an abstraction of spillable memory consumers (of TaskMemoryManager).
MemoryConsumers correspond to individual operators and data structures within a task. TaskMemoryManager receives memory allocation requests from MemoryConsumers and issues callbacks to consumers in order to trigger spilling when running low on memory.
A MemoryConsumer basically tracks how much memory is allocated.
Contract¶
spill¶
void spill() // (1)
long spill(
long size,
MemoryConsumer trigger)
- Uses
MAX_VALUEfor the size and this MemoryConsumer
Used when:
TaskMemoryManageris requested to acquire execution memoryUnsafeExternalSorteris requested to createWithExistingInMemorySorter
Implementations¶
- BytesToBytesMap
LongToUnsafeRowMapRowBasedKeyValueBatch- ShuffleExternalSorter
- Spillable
- UnsafeExternalSorter
Creating Instance¶
MemoryConsumer takes the following to be created:
- TaskMemoryManager
- Page Size
-
MemoryMode(ON_HEAPorOFF_HEAP)
Abstract Class
MemoryConsumer is an abstract class and cannot be created directly. It is created indirectly for the concrete MemoryConsumers.