| Explain garbage collection? |
|
|
|
| Written by Mukesh Ranjan | |
| Wednesday, 16 May 2007 | |
Explain garbage collection?Garbage collection is one of the most important feature of Java. Garbage collection is also called automatic memory management as JVM automatically removes the unused variables/objects (value is null) from the memory. User program can’t directly free the object from memory, instead it is the job of the garbage collector to automatically free the objects that are no longer referenced by a program. Every class inherits finalize() method from java.lang.Object, the finalize() method is called by garbage collector when it determines no more references to the object exists. In Java, it is good idea to explicitly assign null into a variable when no more in use. I Java on calling System.gc() and Runtime.gc(), JVM tries to recycle the unused objects, but there is no guarantee when all the objects will garbage collected. More infoFor more java related stuff visit Mukesh Ranjans site heresubmit your Article, Tutorials or FAQsHello... if you are interested to submit your Article, Tutorials or FAQs on TechXcel.com - provides technical excellence... mail us at This e-mail address is being protected from spam bots, you need JavaScript enabled to view it Comments (0)
![]() Write comment
You must be logged in to a comment. Please register if you do not have an account yet.
Copyright 2007. All Rights Reserved. |