MemoryPool is a bookkeeping abstraction of memory pools.

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


Table 1. MemoryPools
MemoryPool Description



Creating Instance

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

Pool Size

_poolSize: Long = 0

_poolSize is the maximum size of the memory pool.

_poolSize can be expanded or shrinked.

_poolSize is used to report memory free.

Amount of Memory Used

memoryUsed: Long

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

memoryUsed is used when:

Amount of Free Memory

memoryFree: Long

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

memoryFree is used when…​FIXME

Shrinking Pool Size

  delta: Long): Unit

decrementPoolSize makes the _poolSize smaller by the given delta bytes.

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

decrementPoolSize is used when…​FIXME

Expanding Pool Size

  delta: Long): Unit

incrementPoolSize makes the _poolSize bigger by the given delta bytes.

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

incrementPoolSize is used when…​FIXME