gcshrinkstackoff: setting gcshrinkstackoff=1 disables moving goroutines
onto smaller stacks. In this mode, a goroutine's stack can only grow.
- gcrescanstacks: setting gcrescanstacks=1 enables stack
- re-scanning during the STW mark termination phase. This is
- helpful for debugging if objects are being prematurely
- garbage collected.
-
gcstoptheworld: setting gcstoptheworld=1 disables concurrent garbage collection,
making every garbage collection a stop-the-world event. Setting gcstoptheworld=2
also disables concurrent sweeping after the garbage collection finishes.
//
// TODO(austin): Move STW marking out of
// mark termination and eliminate this code path.
- if debug.gcstoptheworld == 0 && debug.gcrescanstacks == 0 {
+ if debug.gcstoptheworld == 0 {
print("runtime: full=", hex(work.full), " nDataRoots=", work.nDataRoots, " nBSSRoots=", work.nBSSRoots, " nSpanRoots=", work.nSpanRoots, " nStackRoots=", work.nStackRoots, "\n")
panic("non-empty mark queue after concurrent mark")
}
// contain pointers to unmarked objects, so on the
// second markroot, there's no need to scan stacks.
work.nStackRoots = 0
-
- if debug.gcrescanstacks > 0 {
- // Scan stacks anyway for debugging.
- work.nStackRoots = int(atomic.Loaduintptr(&allglen))
- }
}
work.markrootNext = 0
lock(&allglock)
// Check that stacks have been scanned.
var gp *g
- if gcphase == _GCmarktermination && debug.gcrescanstacks > 0 {
- for i := 0; i < len(allgs); i++ {
- gp = allgs[i]
- if !(gp.gcscandone && gp.gcscanvalid) && readgstatus(gp) != _Gdead {
- goto fail
- }
- }
- } else {
- for i := 0; i < work.nStackRoots; i++ {
- gp = allgs[i]
- if !gp.gcscandone {
- goto fail
- }
+ for i := 0; i < work.nStackRoots; i++ {
+ gp = allgs[i]
+ if !gp.gcscandone {
+ goto fail
}
}
unlock(&allglock)
gccheckmark int32
gcpacertrace int32
gcshrinkstackoff int32
- gcrescanstacks int32
gcstoptheworld int32
gctrace int32
invalidptr int32
{"gccheckmark", &debug.gccheckmark},
{"gcpacertrace", &debug.gcpacertrace},
{"gcshrinkstackoff", &debug.gcshrinkstackoff},
- {"gcrescanstacks", &debug.gcrescanstacks},
{"gcstoptheworld", &debug.gcstoptheworld},
{"gctrace", &debug.gctrace},
{"invalidptr", &debug.invalidptr},