IntBlockPool

class IntBlockPool @JvmOverloads constructor(allocator: IntBlockPool.Allocator = DirectAllocator())

A pool for int blocks similar to ByteBlockPool

Constructors

Link copied to clipboard
constructor(allocator: IntBlockPool.Allocator = DirectAllocator())

Types

Link copied to clipboard
abstract class Allocator

Abstract class for allocating and freeing int blocks.

Link copied to clipboard
object Companion
Link copied to clipboard

A simple Allocator that never recycles.

Properties

Link copied to clipboard

Current head buffer

Link copied to clipboard

array of buffers currently used in the pool. Buffers are allocated if needed don't modify this outside of this class

Link copied to clipboard

Current head offset

Link copied to clipboard

Pointer to the current position in head buffer

Functions

Link copied to clipboard

Advances the pool to its next buffer. This method should be called once after the constructor to initialize the pool. In contrast to the constructor a IntBlockPool.reset call will advance the pool to its first buffer immediately.

Link copied to clipboard
fun reset(zeroFillBuffers: Boolean, reuseFirst: Boolean)

Expert: Resets the pool to its initial state, while optionally reusing the first buffer. Buffers that are not reused are reclaimed by . Buffers can be filled with zeros before recycling them. This is useful if a slice pool works on top of this int pool and relies on the buffers being filled with zeros to find the non-zero end of slices.