Comment #6 on issue 3691 by
fmuad...@gmail.com: Allow cleanup of an object
Garbage collection should not be visible. But you must be able to manually
destroy any object exacly like the Garbage collector would do. In this way
the Garbage collector will have one less object to worry about.
The ability to manually destroying object instantly is ESSENTIAL for many
algorithms and patterns. Not only for RAII (Resource Acquisition Is
Initialization) techniques for servers, but also for many game loops where
immediate destruction of objects is essential to keep the number of objects
in memory constant at any time and consequently always contained inside the
cache, for assuring decent performances.
Note that what is required is not to "flag" an object to be "ready" to be
collected, but to collect it straight and directly, removing it immediately
from memory without calling the garbage collector at all, but just updating
its object graph to remove the reference just before the destruction.