Class MemoryTrackingContext
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() 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 Summary
ConstructorsConstructorDescriptionMemoryTrackingContext(AggregatedMemoryContext userAggregateMemoryContext, AggregatedMemoryContext revocableAggregateMemoryContext) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()longlongvoidinitializeLocalMemoryContexts(String allocationTag) This method has to be called to initialize the local memory contexts.newUserMemoryContext(String allocationTag) toString()
-
Constructor Details
-
MemoryTrackingContext
public MemoryTrackingContext(AggregatedMemoryContext userAggregateMemoryContext, AggregatedMemoryContext revocableAggregateMemoryContext)
-
-
Method Details
-
close
public void close() -
localUserMemoryContext
-
localRevocableMemoryContext
-
newUserMemoryContext
-
aggregateUserMemoryContext
-
aggregateRevocableMemoryContext
-
newAggregateUserMemoryContext
-
newAggregateRevocableMemoryContext
-
getUserMemory
public long getUserMemory() -
getRevocableMemory
public long getRevocableMemory() -
newMemoryTrackingContext
-
initializeLocalMemoryContexts
This method has to be called to initialize the local memory contexts. Otherwise, calls to methods localUserMemoryContext(), etc. will fail. -
toString
-