Explicit and Automatic memory management


Explicit Memory Management
In many programming language there is an explicit memory management needed. Programmer are responsible for free the memory occupied by the objects.
In explicit memory management dangling reference and space leaks problem occurs.

In dangling reference the space allocated for one object which is already used by some another object and that reference first object's space is released by mistake
and the seconds object tries to access that first object this is called dangling reference problem. In space leaks, some objects are remained in memory by mistake without any use. Those objects never release their memory occupied and that memory space never come in use for required objects.

Automatic Memory Management
Now a days most of the OOP languages have Automatica Memory Managemtnt. In this there is a garbage collector which is reponsible for collecting space for the objects.
and It also release the memory occupied by the objects which has no more use. Means the object which has no reference then its memory will be released by the garbage collector. and the object which has a reference somewhere will never be garbage collected. So, there is neither a problem of space leaks nor a dangling reference.