MemoryPool

final class MemoryPool

Efficient pool of fixed-size memory pages. Allocations from underlying allocator are performed in big chunks of memory that are sliced into pages of requested size.

Pages and chunks are organized in an intrusive linked list way to minimise memory overhead and re-use the same nodes for the whole lifetime of the pool.

Memory is reclaimed back to underlying allocator once the pool is finalized.

Companion:
object
class Object
trait Matchable
class Any

Value members

Concrete methods

def claim(): Page

Borrow a single unused page, to be reclaimed later.

Borrow a single unused page, to be reclaimed later.

def reclaim(head: Page, tail: Page): Unit

Reclaimed a list of previously borrowed pages.

Reclaimed a list of previously borrowed pages.