ArenaPool <Type>
Hierarchy
- ArenaPool
Index
Constructors
Properties
Methods
Constructors
constructor
Type parameters
- Type
Parameters
builder: () => Type
optionalrecycler: (instance: Type) => Type
maxObjects: number = 100
Returns ArenaPool<Type>
Properties
publicbuilder
Type declaration
Returns Type
publicdisableWarnings
publicindex
publicmaxObjects
publicobjects
publicoptionalrecycler
Type declaration
Parameters
instance: Type
Returns Type
publictotalAllocations
Methods
borrow
Use a single instance out of th pool and immediately return it to the pool
Parameters
context: (object: Type) => void
Returns void
dispose
Returns void
done
Signals we are done with the pool objects for now, Reclaims all objects in the pool.
If a list of pooled objects is passed to done they are un-hooked from the pool and are free to be passed to consumers
Parameters
rest...objects: Type[]
A list of object to separate from the pool
Returns Type[]
get
Retrieve a value from the pool, will allocate a new instance if necessary or recycle from the pool
Returns Type
preallocate
Returns void
using
Use many instances out of the in the context and return all to the pool.
By returning values out of the context they will be un-hooked from the pool and are free to be passed to consumers
Parameters
context: (pool: ArenaPool<Type>) => void | Type[]
Returns Type[]
This pool works like an arena allocator, it preallocates a large list of objects and passes them out sequentially It is meant to be freed all at once, so things that can be reclaimed after a frame are the ideal type.
If you need to take singular objects and put singular objects back RentalPool is ideal.