Understanding Java Garbage Collector
Java’s garbage collection system reclaims objects automatically occurring transparently, behind the scenes, without any programmer intervention. It works like this: when no references to an object exist, that object is assumed to be no longer needed, and the memory occupied by the object is released. This recycled memory can then be used for a subsequent allocation. Although it complete transparent to developer, understanding how GC works helps developer to improve efficiency of Java Program. It is also helpful to improve performance of the program. JDK provides many runtime options to analysis GC and analysis your program behavior. Here is the simple java program to understand GC behavior 1: public class GCTest { 2: public GCTest() { 3: } 4: 5: public static void main(String[] args) { 6: int count = 10000; 7: long startTime = System.currentTimeMillis(); 8: System.out.println(" Total Count = " + count...