LruArrayPool

class LruArrayPool : ArrayPool

A fixed size Array Pool that evicts arrays using an LRU strategy to keep the pool under the maximum byte size.

Constructors

Link copied to clipboard
open fun LruArrayPool()
Link copied to clipboard
open fun LruArrayPool(maxSize: Int)
Constructor for a new pool.

Functions

Link copied to clipboard
open fun clearMemory()
Clears all arrays from the pool.
Link copied to clipboard
open fun <T> get(size: Int, arrayClass: Class<T>): T
Returns a non-null array of the given type with a length >= to the given size.
Link copied to clipboard
open fun <T> getExact(size: Int, arrayClass: Class<T>): T
Returns a non-null array of the given type with a length exactly equal to the given size.
Link copied to clipboard
open fun <T> put(array: T)
open fun <T> put(array: T, arrayClass: Class<T>)
Optionally adds the given array of the given type to the pool.
Link copied to clipboard
open fun trimMemory(level: Int)
Trims the size to the appropriate level.

Properties

Link copied to clipboard
val STANDARD_BUFFER_SIZE_BYTES: Int
A standard size to use to increase hit rates when the required size isn't defined.