@ThreadSafe public final class MemoryTrackingContext extends Object
At every level we have three aggregate and three local memory contexts. The local memory contexts track the allocations in the current level while the aggregate memory contexts aggregate the memory allocated by the leaf levels and the current level.
The reason we have local memory contexts at every level is that not all the allocations are done by the leaf levels (e.g., at the pipeline level exchange clients can do system allocations directly, see the ExchangeOperator, another example is the buffers doing system allocations at the task context level, etc.).
As another example, at the pipeline level there will be system allocations initiated by the operator context and there will be system allocations initiated by the exchange clients (local allocations). All these system allocations will be visible in the systemAggregateMemoryContext.
To perform local allocations clients should use localUserMemoryContext()/localSystemMemoryContext() and get a reference to the local memory contexts. Clients can also use updateUserMemory()/tryReserveUserMemory() to allocate memory (non-local allocations), which will be reflected to all ancestors of this context in the hierarchy.
| Constructor and Description |
|---|
MemoryTrackingContext(AggregatedMemoryContext userAggregateMemoryContext,
AggregatedMemoryContext revocableAggregateMemoryContext,
AggregatedMemoryContext systemAggregateMemoryContext) |
| Modifier and Type | Method and Description |
|---|---|
AggregatedMemoryContext |
aggregateUserMemoryContext() |
void |
close() |
long |
getRevocableMemory() |
long |
getSystemMemory() |
long |
getUserMemory() |
void |
initializeLocalMemoryContexts(String allocationTag)
This method has to be called to initialize the local memory contexts.
|
LocalMemoryContext |
localRevocableMemoryContext() |
LocalMemoryContext |
localSystemMemoryContext() |
LocalMemoryContext |
localUserMemoryContext() |
AggregatedMemoryContext |
newAggregateSystemMemoryContext() |
MemoryTrackingContext |
newMemoryTrackingContext() |
LocalMemoryContext |
newSystemMemoryContext(String allocationTag) |
LocalMemoryContext |
newUserMemoryContext(String allocationTag) |
String |
toString() |
public MemoryTrackingContext(AggregatedMemoryContext userAggregateMemoryContext, AggregatedMemoryContext revocableAggregateMemoryContext, AggregatedMemoryContext systemAggregateMemoryContext)
public void close()
public LocalMemoryContext localUserMemoryContext()
public LocalMemoryContext localSystemMemoryContext()
public LocalMemoryContext localRevocableMemoryContext()
public LocalMemoryContext newUserMemoryContext(String allocationTag)
public LocalMemoryContext newSystemMemoryContext(String allocationTag)
public AggregatedMemoryContext aggregateUserMemoryContext()
public AggregatedMemoryContext newAggregateSystemMemoryContext()
public long getUserMemory()
public long getRevocableMemory()
public long getSystemMemory()
public MemoryTrackingContext newMemoryTrackingContext()
public void initializeLocalMemoryContexts(String allocationTag)
Copyright © 2012–2019. All rights reserved.