Automatic memory management, also known as automatic garbage collection, is the practice of allowing the language implementation to keep track of used and unused memory, freeing the programmer from this burden.
In languages without automatic memory management, the programmer must reserve memory when it is required and mark it as free once its contents no longer have effect in the running program. For example, in the C programming language (probably the most commonly used of those without automatic memory management) this is achieved by using the functions malloc, calloc, realloc, alloc and free.
On the other hand, languages (or implementations) with automatic memory management automatically reserve memory when it is required for storing new values and reclaim it (free it) when their contents can no longer affect future computations
(1) Java automatically does the Garbage collecting and probably does a better job than most developers on the down side.
(2) By auto Garbage collecting it takes away an opportunity for developers to optimise garbage collecting and auto Garbage collecting can be seen as a constraint not a benefit.
In the most part it is a benefit because it simplifies programming in Java and is probably more efficient at garbage collecting than self regulated Garbage collecting, unless people spent time researching the best way to garbage collect.
Garbage collection concerns objects with dynamic extent (allocated with a new statement in these languages). Java uses various techniques to automaticallydiscover when these objects are no longer referred to, and to reclaim them. Incontrast, C++ programmers manually specify where an object with dynamicextent is to be reclaimed by coding a delete statement.
_ Java classes can have a finalize function.
_ Java uses run-time processing to discover dead objects (which are eligible for reclamation).