aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/malloc.go
diff options
context:
space:
mode:
authorRick Hudson <rlh@golang.org>2014-10-24 11:07:16 -0400
committerRick Hudson <rlh@golang.org>2014-10-24 11:07:16 -0400
commit6184f46ea359bd6d4da92cb80ba20d219222aa00 (patch)
tree55734ae0102163371d8da408979cca32ba06bd71 /src/runtime/malloc.go
parent62a4359e2e479dc7392b645faecf7cdc5ff4cda0 (diff)
downloadgo-6184f46ea359bd6d4da92cb80ba20d219222aa00.tar.xz
[dev.garbage] runtime: Concurrent scan code
Routines and logic to preform a concurrent stack scan of go-routines. This CL excersizes most of the functionality needed. The major exception being that it does not scan running goroutines. After doing the scans it relies on a STW to finish the GC, including rescanning the stacks. It is intended to achieve correctness, performance will follow. LGTM=rsc R=golang-codereviews, rsc CC=dvyukov, golang-codereviews https://golang.org/cl/156580043
Diffstat (limited to 'src/runtime/malloc.go')
-rw-r--r--src/runtime/malloc.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go
index 9b4264f2b3..c56e038865 100644
--- a/src/runtime/malloc.go
+++ b/src/runtime/malloc.go
@@ -438,7 +438,15 @@ func gogc(force int32) {
mp = acquirem()
mp.gcing = 1
releasem(mp)
+
onM(stoptheworld)
+ onM(finishsweep_m) // finish sweep before we start concurrent scan.
+ onM(starttheworld)
+
+ // Do a concurrent heap scan before we stop the world.
+ onM(gcscan_m)
+ onM(stoptheworld)
+
if mp != acquirem() {
gothrow("gogc: rescheduled")
}