The number of objects currently available in the pool.
The total number of objects managed by this pool (both available and in use).
The number of objects that are currently "checked out" of the pool.
Allows the pool to be used in for...of loops, iterating over available items.
Returns an object with the current pool statistics.
An object containing capacity, available, inUse, and utilizationRate.
Retrieves an object from the pool. If the pool is empty, it will automatically grow to create new objects.
An object of type T.
Explicitly adds a specified number of new objects to the pool.
The number of new objects to create.
Returns an object to the pool, making it available for reuse.
The object to return to the pool.
Forcibly returns all borrowed items to the pool.
This is a powerful tool for preventing memory leaks. By calling this at the beginning of a frame or a top-level operation, you ensure that any objects that were not explicitly released are reclaimed.
A generic object pool for recycling objects to reduce pressure on the garbage collector.