Java garbage collector
by, 01-08-2012 at 12:53 PM (1959 Views)
A new object is stored into heap when it is created by the Java Program. Heap is also call garbage collectable heap and it can be released by the garbage collector. Garbage collector is a JVM low priority thread and its execution cannot be forced. It is executed to release memory allocated to unused object. Also you can ask garbage collector to release memory by using System.gc()
Object is unreachable when it has no other object that is referencing to this object. In such cases this object is collected and memory is released by the garbage collector. Garbage collector automatically collects all such objects and releases memory used by these objects.