Constructs a new InstancePool.
Private
clazzMaps class names to their constructors for instantiation.
Private
poolThe pool of reusable instances, keyed by class name.
Private
usedTracks the number of used instances for each class.
Retrieves an instance of the specified class from the pool or creates a new one if none are available.
The type of the reusable instance.
The name of the class to retrieve an instance for.
Optional
clazz: new () => TThe constructor of the class to instantiate if no instances are available in the pool.
An instance of the specified class.
Returns the counts of items in the pool for each class.
An object where the keys are class names and the values are the counts of items in the pool.
Prepopulates the pool with a specified number of items.
The class name to use as the key in the pool.
The class constructor to create new instances.
The number of items to create and add to the pool.
InstancePool manages reusable object instances for performance and memory efficiency. Implements the IInstancePool interface.