Wednesday, 12 October 2011

Garbage collection


Since object dynamically allocated By using new operators you might be wondering hoe such objects are destroyed and their memory released for the letter reallocation. In some language such as C++ dynamically allocates objects must be released manually by the use of delete operators but Java takes a different approaches for this. It handles deallocation for you automatically The technique used to do this is known as garbage collection. It works like this.

When no references to an objects exist means objects is assumed to be no longer needed than the memory occupied by the object is released. There is no explicate need to destroyed. The object as in C++ garbage collection only occurs periodically during the execution of your program.

Java garbage collection is the make sweep garbage collection. A mark-sweep garbage collection score dynamic memory areas for object and marks those that are reference. After all possible path to objects are investigated unmarked objects are known to be garbage and are collection.


Posted by :Ruchita Pandya

No comments:

Post a Comment