🎁 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

Observer Pattern
A design pattern where an object (subject) maintains a list of dependents (observers) that are notified automatically of state changes.
Refactoring
Restructuring existing code without changing its external behavior to improve readability, maintainability, and performance.
Memoization
An optimization technique that caches function results for given inputs, avoiding redundant computations for repeated calls.
Binary Search
An efficient search algorithm that finds a target value in a sorted array by repeatedly dividing the search interval in half.
Algorithm
A step-by-step procedure for solving a problem or performing a computation, defined as a finite sequence of instructions.
Unit Testing
Testing individual components or functions of a program in isolation to verify they work correctly.
View All Programming Concepts Terms →