AbstractStaticdumpEmptys the depot of a given type, leaving the objects for the garbage collector. May result in a short stall when many objects were in
StaticdumpEmptys all depots, leaving all objects to the garbage collector. May result in a short stall when many objects were in
StaticgetFetches an object of the requested type from the depot, calls its recycle-method and returns it. If the depot for that type is empty it returns a new object of the requested type.
The class identifier of the desired object
StaticreuseFetches an object of the requested type from the depot and returns it. ⚠️DOES NOT call its recycle-method. Faster than Recycler.get, but should be used with caution.
StaticstoreStores the object in the depot for later recycling. Users are responsible for throwing in objects that are about to loose scope and are not referenced by any other
Keeps a depot of objects that have been marked for reuse, sorted by type.
Using Recycler reduces load on the carbage collector and thus supports smooth performance.
Author
Jirka Dell'Oro-Friedl, HFU, 2021
Link
https://github.com/hs-furtwangen/FUDGE/wiki/Recycler