You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The logic to trigger periodic GC is such that if GC is disabled but at least one GC cycle has ever happened (e.g., GC was disabled at runtime by SetGCPercent(-1) or runtime.GC() was called), then once the periodic GC period has elapsed (2 minutes by default), sysmon will attempt to trigger a GC every 10ms. This GC will be a no-op, but it still goes through the motions of waking the goroutine and prints a gctrace line.
The following program demonstrates this:
package main
import"runtime"funcmain() {
runtime.GC()
for {
fib(10)
}
}
funcfib(nint) int {
ifn<=2 {
return1
}
returnfib(n-1) +fib(n-2)
}
If run with GODEBUG=gctrace=1 GOGC=off ./test, then after two minutes the runtime will print GC forced every 10ms. (If you don't want to wait two minutes, add forcegcperiod = 10 * 1e9 to sysmon.)
AFAIK this isn't happening in the wild. I found this while reworking the triggering logic.
The logic to trigger periodic GC is such that if GC is disabled but at least one GC cycle has ever happened (e.g., GC was disabled at runtime by
SetGCPercent(-1)
orruntime.GC()
was called), then once the periodic GC period has elapsed (2 minutes by default), sysmon will attempt to trigger a GC every 10ms. This GC will be a no-op, but it still goes through the motions of waking the goroutine and prints a gctrace line.The following program demonstrates this:
If run with
GODEBUG=gctrace=1 GOGC=off ./test
, then after two minutes the runtime will printGC forced
every 10ms. (If you don't want to wait two minutes, addforcegcperiod = 10 * 1e9
tosysmon
.)AFAIK this isn't happening in the wild. I found this while reworking the triggering logic.
/cc @RLH
The text was updated successfully, but these errors were encountered: