🎁 New User? Get 20% off your first purchase with code NEWUSER20 Register Now →
Menu

Categories

Programming Concepts Intermediate

What is Garbage Collection?

An automatic memory management process that identifies and reclaims memory no longer in use by a program.

Garbage collection (GC) frees developers from manual memory management. The GC periodically identifies objects that are no longer reachable from any reference and reclaims their memory. This prevents memory leaks and dangling pointer bugs.

Common algorithms include reference counting (Python, PHP), mark-and-sweep (JavaScript), and generational collection (Java, .NET). GC introduces some overhead and occasional pauses. Languages like C/C++ and Rust use manual or ownership-based memory management instead.

Related Terms

Stack
A data structure that follows Last-In-First-Out (LIFO) ordering, where elements are added and removed from the same end (top).
Clean Code
Code that is easy to read, understand, and maintain — following consistent conventions, meaningful naming, and single-responsibility functions.
Event-Driven Architecture
A software design pattern where components communicate by producing and consuming events rather than direct method calls.
Closure
A function that captures and retains access to variables from its enclosing scope, even after that scope has finished executing.
Thread
The smallest unit of execution within a process, allowing concurrent operations to run within a single program.
Technical Debt
The implied cost of additional rework caused by choosing a quick solution now instead of a better approach that would take longer.
View All Programming Concepts Terms →