mirror of
https://github.com/golang/go.git
synced 2024-09-22 10:58:58 +00:00
runtime/debug: force GC after setting of GCPercent to make it effective.
See also discussion in CL 51010045. R=golang-codereviews, r CC=golang-codereviews https://golang.org/cl/52230043
This commit is contained in:
parent
71377d3cd3
commit
0db71338ed
@ -91,7 +91,9 @@ func (x byDuration) Less(i, j int) bool { return x[i] < x[j] }
|
||||
// at startup, or 100 if the variable is not set.
|
||||
// A negative percentage disables garbage collection.
|
||||
func SetGCPercent(percent int) int {
|
||||
return setGCPercent(percent)
|
||||
old := setGCPercent(percent)
|
||||
runtime.GC()
|
||||
return old
|
||||
}
|
||||
|
||||
// FreeOSMemory forces a garbage collection followed by an
|
||||
|
Loading…
Reference in New Issue
Block a user