GOGC
The GOGC variable allows us to tune the intensity of the Go garbage collection system. The garbage collector (instantiated at https://golang.org/src/runtime/mgc.go) reads the GOGC variable and determines the value of the garbage collector. A value of off sets the garbage collector off. This is often useful for debugging but not sustainable in the long term as the program needs to free memory that is collected within the executable's heap. Setting this value to less than the default value of 100 will cause the garbage collector to execute more frequently. Setting this value larger than the default value of 100 will cause the garbage collector to execute less frequently. Very often for multi-core large machines, garbage collection happens ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access