File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -234,6 +234,7 @@ func schedule(d time.Duration) (<-chan time.Time, *time.Time) {
234
234
}
235
235
236
236
func (s * gcScheduler ) run (ctx context.Context ) {
237
+ const minimumGCTime = float64 (5 * time .Millisecond )
237
238
var (
238
239
schedC <- chan time.Time
239
240
@@ -331,6 +332,11 @@ func (s *gcScheduler) run(ctx context.Context) {
331
332
// runtime in between gc to reach the pause threshold.
332
333
// Pause threshold is always 0.0 < threshold <= 0.5
333
334
avg := float64 (gcTimeSum ) / float64 (collections )
335
+ // Enforce that avg is no less than minimumGCTime
336
+ // to prevent immediate rescheduling
337
+ if avg < minimumGCTime {
338
+ avg = minimumGCTime
339
+ }
334
340
interval = time .Duration (avg / s .pauseThreshold - avg )
335
341
}
336
342
You can’t perform that action at this time.
0 commit comments