Skip to content


= MemoryPool

MemoryPool is a bookkeeping abstraction of <>.

MemoryPool is used by the[MemoryManager] to track the division of memory between storage and execution.

== [[extensions]] Extensions

.MemoryPools [cols="30,70",options="header",width="100%"] |=== | MemoryPool | Description

|[ExecutionMemoryPool] | [[ExecutionMemoryPool]]

|[StorageMemoryPool] | [[StorageMemoryPool]]


== [[creating-instance]][[lock]] Creating Instance

MemoryPool takes a single lock object to be created (used for synchronization).

== [[_poolSize]][[poolSize]] Pool Size


_poolSize: Long = 0

++_poolSize++ is the maximum size of the memory pool.

++_poolSize++ can be <> or <>.

++_poolSize++ is used to report <>.

== [[memoryUsed]] Amount of Memory Used

[source, scala]

memoryUsed: Long

memoryUsed gives the amount of memory used in this pool (in bytes).

memoryUsed is used when:

  • MemoryManager is requested for the[total storage memory in use]

  • MemoryPool is requested for the current <> and to <>

  • StorageMemoryPool is requested to acquireMemory

  • UnifiedMemoryManager is requested to[maxOnHeapStorageMemory],[maxOffHeapStorageMemory] and[acquireExecutionMemory]

== [[memoryFree]] Amount of Free Memory

[source, scala]

memoryFree: Long

memoryFree gives the amount of free memory in the pool (in bytes) by simply subtracting the <> from the <<_poolSize, _poolSize>>.

memoryFree is used when...FIXME

== [[decrementPoolSize]] Shrinking Pool Size

[source, scala]

decrementPoolSize( delta: Long): Unit

decrementPoolSize makes the <<_poolSize, _poolSize>> smaller by the given delta bytes.

decrementPoolSize requires that the given delta bytes has to meet the requirements:

  • be positive

  • up to the current <<_poolSize, _poolSize>>

  • Does not shrink the current <<_poolSize, _poolSize>> below the <> threshold

decrementPoolSize is used when...FIXME

== [[incrementPoolSize]] Expanding Pool Size

[source, scala]

incrementPoolSize( delta: Long): Unit

incrementPoolSize makes the <<_poolSize, _poolSize>> bigger by the given delta bytes.

incrementPoolSize requires that the given delta bytes has to be positive.

incrementPoolSize is used when...FIXME

Last update: 2020-10-06