Programming languages such as C, C++ provide more flexibility over memory management. Java has its own way of garbage collection. In Java garbage collection occurs when an object is removed from memory. Programmer has no control over when the garbage collection occurs. Programmer can neither delay it nor decide when to do the garbage collection. Though this reduces chances of memory leak to a great extent and make progamming easy so that programmer can focus on another important aspect, it also reduces the flixibility where in some cases a more efficient memory management can be done.
(more…)