Go theorytheory 0/50 · 0%
Runtime · hard

39. Garbage Collection and Performance

Allocation, escape analysis and GOGC.

Go's concurrent GC targets low pause times; throughput is tuned with GOGC or a soft memory limit. Reduce pressure by avoiding unnecessary allocations, reusing buffers with sync.Pool, preallocating slices and keeping values on the stack when escape analysis allows.

Check your understanding

  1. 1. Which tool shows why a value escapes to the heap?

  2. 2. sync.Pool exists to…