When was garbage collection first implemented? What does it do? How does it work?
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Garbage collection was first implemented by John McCarthy in the 1960s while working on the Lisp programming language. It is used by modern JVMs to automatically free up memory space previously occupied by objects that are no longer referenced (ie “garbage”).
Garbage collection works by examining the references between objects in a program, starting with the root(s) of your application’s reachable object graph. If an object has none of its fields pointing at it, then it is garbage and can be freed. To do this efficiently requires that garbage collectors for languages like Java or C++ have what is known as generational hypothesis: most objects die young – meaning they only live for a short amount of time before being discarded. This hypothesis allows them to focus their effort on young garbage objects, which are more likely to be garbage than older objects.