Each of these classes has its uses in managing memory. A reference object can be registered with a queue, and it will be enqueued when the collector determines that the referent is softly , weakly or phantom reachable , as the case may be. A program can use these queues to perform some action when an object is dying. This allows finer control than the older finalization mechanism alone. Guardians in a Generation-Based Garbage Collector .
Region inference infers a region for each object.
When a region dies, all the objects in it are known to be dead , whether reachable or not. In this way, region inference occupies a middle ground between stack allocation and heap allocation . Mads Tofte, Jean-Pierre Talpin. Region-Based Memory Management . Please see our feedback page for submission information.