Allow environment var GOGC=<percent> to override hard-coded SetGCPercent(10) #45

Merged
moodyjon merged 1 commit from gogc_env_var into master 2022-06-03 18:19:55 +02:00

View file

@ -281,7 +281,9 @@ func main() {
// limits the garbage collector from excessively overallocating during // limits the garbage collector from excessively overallocating during
// bursts. This value was arrived at with the help of profiling live // bursts. This value was arrived at with the help of profiling live
// usage. // usage.
debug.SetGCPercent(10) if _, ok := os.LookupEnv("GOGC"); !ok {
debug.SetGCPercent(10)
}
// Up some limits. // Up some limits.
if err := limits.SetLimits(); err != nil { if err := limits.SetLimits(); err != nil {