Garbage Collection in Java | Memory Deallocation | Java for Beginner | Java Basic.



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.



Post a Comment

1 Comments