aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/debug/garbage.go
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2017-04-04 13:26:28 -0400
committerAustin Clements <austin@google.com>2017-04-21 17:42:02 +0000
commit227fff2ea4f21ec357eebe27324cc04b7c9919c7 (patch)
treebdfc85c7e04b189e584599665ca113d361056413 /src/runtime/debug/garbage.go
parentd9308cbb516fc581ff7c7f77781d51604be44da6 (diff)
downloadgo-227fff2ea4f21ec357eebe27324cc04b7c9919c7.tar.xz
runtime/debug: don't trigger a GC on SetGCPercent
Currently SetGCPercent forces a GC in order to recompute GC pacing. Since we can now recompute pacing on the fly using gcSetTriggerRatio, change SetGCPercent (really runtime.setGCPercent) to go through gcSetTriggerRatio and not trigger a GC. Fixes #19076. Change-Id: Ib30d7ab1bb3b55219535b9f238108f3d45a1b522 Reviewed-on: https://go-review.googlesource.com/39835 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Rick Hudson <rlh@golang.org>
Diffstat (limited to 'src/runtime/debug/garbage.go')
-rw-r--r--src/runtime/debug/garbage.go6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/runtime/debug/garbage.go b/src/runtime/debug/garbage.go
index 27adc70fd3..785e9d4598 100644
--- a/src/runtime/debug/garbage.go
+++ b/src/runtime/debug/garbage.go
@@ -89,11 +89,7 @@ func ReadGCStats(stats *GCStats) {
// at startup, or 100 if the variable is not set.
// A negative percentage disables garbage collection.
func SetGCPercent(percent int) int {
- old := setGCPercent(int32(percent))
- if percent >= 0 {
- runtime.GC()
- }
- return int(old)
+ return int(setGCPercent(int32(percent)))
}
// FreeOSMemory forces a garbage collection followed by an