๐ŸŽ New User? Get 20% off your first purchase with code NEWUSER20 ยท โšก Instant download ยท ๐Ÿ”’ Secure checkout 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

Factory Pattern
A creational design pattern that provides an interface for creating objects without specifying their exact classes.
Functional Programming
A programming paradigm that treats computation as the evaluation of mathematical functions, avoiding state changes and mutable data.
Concurrency
The ability of a program to manage multiple tasks that can make progress during overlapping time periods.
Big O Notation
A mathematical notation that describes the worst-case performance of an algorithm as input size grows.
Memoization
An optimization technique that caches function results for given inputs, avoiding redundant computations for repeated calls.
Immutable Object
An object whose state cannot be modified after creation, providing thread safety and predictable behavior in concurrent systems.
View All Programming Concepts Terms โ†’