Commit 9d7dad18 authored by Michael Anthony Knyszek's avatar Michael Anthony Knyszek Committed by Ian Lance Taylor
Browse files

[release-branch.go1.14] runtime: ensure minTriggerRatio never exceeds maxTriggerRatio

Currently, the capping logic for the GC trigger ratio is such that if
gcpercent is low, we may end up setting the trigger ratio far too high,
breaking the promise of SetGCPercent and GOGC has a trade-off knob (we
won't start a GC early enough, and we will use more memory).

This change modifies the capping logic for the trigger ratio by scaling
the minTriggerRatio with gcpercent the same way we scale
maxTriggerRatio.

For #37927.
Fixes #37928.

Change-Id: I2a048c1808fb67186333d3d5a6bee328be2f35da
Reviewed-on: https://go-review.googlesource.com/c/go/+/223937


Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarAustin Clements <austin@google.com>
(cherry picked from commit d1ecfcc1)
Reviewed-on: https://go-review.googlesource.com/c/go/+/225637


Reviewed-by: default avatarDavid Chase <drchase@google.com>
parent 612ef03a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment