The ObjectPool stores objects that are no longer used to prevent needlessly instanciating objects and to reduce the amount of garbage.
- array<Object> Objects
- Stores all unallocated objects.
- Object AllocateObject (class ObjectClass) [simulated]
- Returns an object of the specified class. The object is taken from the Objects array or if no object of the specified class is found a new object is created. See Creating Actors and Objects.
- FreeObject (Object Obj) [simulated]
- Adds an object to the Objects array.
Important: You have to make sure there are no more references to the object before using FreeObject.
- Shrink ( ) [simulated]
- Clears the Objects array. All objects without references are marked for garbage-collection. See Destroying Objects.