mirror of
https://github.com/golang/go
synced 2024-11-18 11:55:01 -07:00
runtime: do not unmap work.spans until after checkmark phase
This is causing crashes. Change-Id: I1832f33d114bc29894e491dd2baac45d7ab3a50d Reviewed-on: https://go-review.googlesource.com/5330 Reviewed-by: Rick Hudson <rlh@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
parent
6c4b54f409
commit
5254b7e9ce
@ -616,6 +616,15 @@ func gc(start_time int64, eagersweep bool) {
|
||||
sweep.npausesweep = 0
|
||||
}
|
||||
|
||||
if debug.gccheckmark > 0 {
|
||||
if !checkmarkphase {
|
||||
// first half of two-pass; don't set up sweep
|
||||
return
|
||||
}
|
||||
checkmarkphase = false // done checking marks
|
||||
clearCheckmarks()
|
||||
}
|
||||
|
||||
// See the comment in the beginning of this function as to why we need the following.
|
||||
// Even if this is still stop-the-world, a concurrent exitsyscall can allocate a stack from heap.
|
||||
lock(&mheap_.lock)
|
||||
@ -624,16 +633,6 @@ func gc(start_time int64, eagersweep bool) {
|
||||
sysFree(unsafe.Pointer(&work.spans[0]), uintptr(len(work.spans))*unsafe.Sizeof(work.spans[0]), &memstats.other_sys)
|
||||
}
|
||||
|
||||
if debug.gccheckmark > 0 {
|
||||
if !checkmarkphase {
|
||||
// first half of two-pass; don't set up sweep
|
||||
unlock(&mheap_.lock)
|
||||
return
|
||||
}
|
||||
checkmarkphase = false // done checking marks
|
||||
clearCheckmarks()
|
||||
}
|
||||
|
||||
// Cache the current array for sweeping.
|
||||
mheap_.gcspans = mheap_.allspans
|
||||
mheap_.sweepgen += 2
|
||||
|
Loading…
Reference in New Issue
Block a user