Skip to content

Commit 0293a1f

Browse files
committed
runtime: avoid large object stack copy in traceStackTable.dump
Following up on the previous CL, this CL removes a unnecessary stack copy of a large object in a range loop. This drops another 64 KiB from (*traceStackTable).dump's stack frame so it is now roughly 80 bytes depending on architecture, which will easily fit on the system stack. For #53979. Change-Id: I16f642f6f1982d0ed0a62371bf2e19379e5870eb Reviewed-on: https://go-review.googlesource.com/c/go/+/422955 Reviewed-by: Michael Knyszek <mknyszek@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Austin Clements <austin@google.com>
1 parent d4a3466 commit 0293a1f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: src/runtime/trace.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1060,8 +1060,8 @@ func traceFrames(bufp traceBufPtr, pcs []uintptr) ([]traceFrame, traceBufPtr) {
10601060
// releases all memory and resets state.
10611061
func (tab *traceStackTable) dump() {
10621062
bufp := traceFlush(0, 0)
1063-
for _, stk := range tab.tab {
1064-
stk := stk.ptr()
1063+
for i, _ := range tab.tab {
1064+
stk := tab.tab[i].ptr()
10651065
for ; stk != nil; stk = stk.link.ptr() {
10661066
var frames []traceFrame
10671067
frames, bufp = traceFrames(bufp, stk.stack())

0 commit comments

Comments
 (0)