Garbage Collector
Garbage Collector
Garbage Collector
How does garbage collector decide which objects are to be removed? Can garbage collector be forced? Garbage collector is invoked by JVM automatically. This function checks for all the object in heap memory and whether oject are having any refrence or not. If an object does have any refrence variable means it is unreachable then garbage collector frees that memory. By using system.gc() commond we can run garbage collector forcefully. Garbage collector removes those objects from heap memory which are no longer referred by any other objects. Using System.gc() you can call garbage collector but its not neccesary that it will run. JVM decides when the Garbage Collector will run.
1)whether we can set the time implicitly for the garbage collection?
Latest Answer : No you cannot start garbage collection by your own.By executing System.gc() you just b sure that GC will b run, but when cannot be told. ... Read Answers (3) | Asked by : chandu Answer Question Subscribe
Answer Question
Subscribe
Why there is no guarentee for System.gc() method will perform garbage collection for a particular time?
Why there is no guarentee for System.gc() method will perform garbage collection for a particular time? Read Answers (2) | Asked by : chandu Answer Question Subscribe