]> Cypherpunks repositories - gostls13.git/commit
runtime/debug: make SetGCPercent(-1) wait for concurrent GC
authorAustin Clements <austin@google.com>
Tue, 21 Nov 2017 22:19:43 +0000 (17:19 -0500)
committerAustin Clements <austin@google.com>
Wed, 22 Nov 2017 14:47:12 +0000 (14:47 +0000)
commit64b68bedc52d0b6eb7f464793c2be38382fadb6b
tree2eb1266f21d36f8180b45d3e1ecb3ea13520d3be
parent48e207d518b2924fee598a8442230635d60649a9
runtime/debug: make SetGCPercent(-1) wait for concurrent GC

Currently, SetGCPercent(-1) disables GC, but doesn't wait for any
currently running concurrent GC to finish, so GC can still be running
when it returns. This is a change in behavior from Go 1.8, probably
defies user expectations, and can break various runtime tests that
depend on SetGCPercent(-1) to disable garbage collection in order to
prevent preemption deadlocks.

Fix this by making SetGCPercent(-1) block until any concurrently
running GC cycle finishes.

Fixes #22443.

Change-Id: I904133a34acf97a7942ef4531ace0647b13930ef
Reviewed-on: https://go-review.googlesource.com/79195
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/runtime/mgc.go