0PricingLogin
Go Academy · Lesson

Garbage Collector Internals

Tri-color mark-sweep, GOGC, and GC pauses

Tri-color mark-and-sweep

Go's GC uses a concurrent tri-color mark-and-sweep algorithm. Objects are white (unvisited), grey (found but children unscanned), or black (fully scanned). White objects are garbage at sweep.

Concurrent GC

The Go GC runs mostly concurrently with application goroutines. This reduces stop-the-world (STW) pauses to sub-millisecond durations in most programs.

All lessons in this course

  1. Stack vs Heap and Escape Analysis
  2. The Go Memory Model and Happens-Before
  3. Garbage Collector Internals
  4. Reducing Allocations: sync.Pool and Arenas
← Back to Go Academy