Garbage collection (computer science)

In computer science, garbage collection is the process in which memory that was dynamically allocated during the execution of a program is reclaimed after its execution. [1]

Pointer Management

When an object is created memory is allocated for it and a pointer is created which refers to where this memory exists. A program counts each time the program requires this object as it might be referenced in many parts of the program. When no parts of the program are aware of the object both its reference and the memory given to it are cleared, making way for more objects to be created.