I Help You
Programming

Garbage Collection

Garbage collection is automatic memory management: the language runtime finds objects that the program can no longer reach and frees the memory they use. Programmers do not have to release memory by hand, which prevents common bugs such as memory leaks, freeing memory twice and using memory after it has been freed.

Java, C#, Python, JavaScript and Go all use garbage collectors. Common techniques include mark-and-sweep, generational collection (young objects are checked more often, since most die young) and reference counting. The cost is extra CPU work and occasional short pauses; languages such as C and C++ leave memory management to the programmer instead.