13 September 2009
0 Basic JAVA Tutorial - JAVA Architecture
Basic JAVA Tutorial - CHAPTER-7 Architecture of JVM Runtime Environment
JAVA Platform Architecture Continues..
Garbage Collection
As the objects are dynamically allocated memory by using "new" operator, they must be released for later reallocation. Java handles de-allocation automatically. This technique is called Garbage Collection.
When no references to an object exist, that object is assumed to be no longer needed and the memory occupied by the object can be reclaimed. This is done by Garbage Collection. Garbage Collection occurs periodically during the execution of the program.
Finalize
Finalize method is used when certain objects are required to perform some action when they are destroyed. By using this method, we can define specific actions that will occur when an object is just about to be reclaimed by the garbage collector.
When certain objects are required to perform some action when they are destroyed then those actions can be added by defining finalize() method. Java Run time calls that method whenever it is about to recycle an object of that class.
The Garbage collector runs periodically, checking for objects that are no longer referenced by any running state or indirectly through other referenced objects. Right before an object is freed, the Java Run time calls the finalize() method on that object.
0 comments:
Please give your valuable comments.