What is garbage collection?
Garbage Collection (GC) refers to the automatic storage allocation mechanisms present in many Lisps. There are several kinds of storage allocation algorithms, but most fall within two main classes: 1. Stop and Copy. Systems which copy active objects from “old” storage to “new” storage and then recycle the old storage. 2. Mark and Sweep. Systems which link together storage used by discarded objects. Generational scavenging garbage collection (aka emphemeral GC) is a variation in which memory is allocated in layers, with tenured (long-lived) objects in the older layers. Rather than doing a full GC of all of memory every time more room is needed, only the last few layers are GCed during an ephemeral GC, taking much less time. Short-lived objects are quickly recycled, and full GCs are then much less frequent. It is most often used to improve the performance of stop and copy garbage collectors. It is possible to implement ephemeral GC in mark and sweep systems, just much more difficult. Sto
Garbage collection refers to the periodic retreival of memory that is no longer used, typically from objects that have been deleted, but other O/S will do resource based collection also. In C++/C days when an application allocated memory or created objects it was the applications responsibility to return it to the pool. Many times coders would forget that resulting in memory leaks and eventually exhaustion of memory. Newer environment like C# and Java handle that automatically. The have built in mechanisms to know when something is no longer required and thus puts in back in the pool for the next application request.