Skip to content

Commit edc2d17

Browse files
committed
runtime: remove GODEBUG=gctrace=2 mode
It turns out if you set GODEBUG=gctrace=2, it enables an obscure debugging mode that, in addition to printing gctrace statistics, also does a second STW GC following each regular GC. This debugging mode has long since lost its value (you could maybe use it to analyze floating garbage, except that we don't print the gctrace line on the second GC), and it interferes substantially with the operation of the GC by messing up the statistics used to schedule GCs. It's also a source of mark termination GC work when we're in concurrent GC mode, so it's going to interfere with eliminating mark 2. And it's going to get in the way of unifying STW and concurrent GC. This CL removes this debugging mode. Updates #26903. This is preparation for eliminating mark 2 and unifying STW GC and concurrent GC. Change-Id: Ib5bce05d8c4d5b6559c89a65165d49532165df07 Reviewed-on: https://go-review.googlesource.com/c/134316 Run-TryBot: Austin Clements <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Rick Hudson <[email protected]>
1 parent 9c634ea commit edc2d17

File tree

2 files changed

+1
-19
lines changed

2 files changed

+1
-19
lines changed

src/runtime/extern.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ It is a comma-separated list of name=val pairs setting these named variables:
6161
6262
gctrace: setting gctrace=1 causes the garbage collector to emit a single line to standard
6363
error at each collection, summarizing the amount of memory collected and the
64-
length of the pause. Setting gctrace=2 emits the same summary but also
65-
repeats each collection. The format of this line is subject to change.
64+
length of the pause. The format of this line is subject to change.
6665
Currently, it is:
6766
gc # @#s #%: #+#+# ms clock, #+#/#/#+# ms cpu, #->#-># MB, # MB goal, # P
6867
where the fields are as follows:

src/runtime/mgc.go

-17
Original file line numberDiff line numberDiff line change
@@ -1558,23 +1558,6 @@ func gcMarkTermination(nextTriggerRatio float64) {
15581558
// marking is complete so we can turn the write barrier off
15591559
setGCPhase(_GCoff)
15601560
gcSweep(work.mode)
1561-
1562-
if debug.gctrace > 1 {
1563-
startTime = nanotime()
1564-
// The g stacks have been scanned so
1565-
// they have gcscanvalid==true and gcworkdone==true.
1566-
// Reset these so that all stacks will be rescanned.
1567-
gcResetMarkState()
1568-
finishsweep_m()
1569-
1570-
// Still in STW but gcphase is _GCoff, reset to _GCmarktermination
1571-
// At this point all objects will be found during the gcMark which
1572-
// does a complete STW mark and object scan.
1573-
setGCPhase(_GCmarktermination)
1574-
gcMark(startTime)
1575-
setGCPhase(_GCoff) // marking is done, turn off wb.
1576-
gcSweep(work.mode)
1577-
}
15781561
})
15791562

15801563
_g_.m.traceback = 0

0 commit comments

Comments
 (0)