In some languages, such as C++, dynamically allocated objects must be manually released by use of a delete operator.
Java takes a different approach; it handles deallocation for you automatically. The technique that accomplishes this is called garbage collection.
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 can be reclaimed.
Garbage collection only occurs sporadically during the execution of your program.
1 Comments
Yah... In Java Garbage Collection is done
ReplyDelete