Garbage collection automatically reclaims memory a program can no longer access. Go includes it in the runtime, reducing the need for manual memory management in applications. section 1.3.1 section 1.1
Go’s garbage collection shapes practical language and platform choices:
- It trades some control over memory and runtime interruptions for fewer memory leaks and buffer-overflow risks associated with manual management. section 1.3.1
- It generally has little noticeable effect on runtime performance, while still allowing targeted optimization when necessary. section 1.3.3
- It makes Go a practical fit for services and system-level processes, but limits its suitability for resource-constrained embedded systems. section 1.3
Disabling collection for an experiment
Set the environment variable GOGC to "off" to disable garbage collection. This is an exceptional tuning choice: use caution because most applications do not need it. section 1.3.3
Figure 1.5 Java and Go running in an operating system
Compare how Java and Go execute with runtime support inside an operating-system environment. section 1.3.3








