-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
Milestone
Description
Using 4764d6f
Using the weblist command in pprof now generates an unreasonably large html file. In Go1.6 this generates a 209KB html file, while HEAD generates a 450MB html file for even a simple benchmark. On larger benchmarks (which are far more common), this crashes the system by using up all system memory.
Current behavior:
$ go.dev test -c foo_test.go
$ ./foo.test -test.bench . -test.cpuprofile /tmp/cpu.out
$ go.dev tool pprof ./foo.test /tmp/cpu.out
(pprof) weblist # Stalls for several seconds... the output html file is 450MB
Wanted behavior:
$ go1.6 test -c foo_test.go
$ ./foo.test -test.bench . -test.cpuprofile /tmp/cpu.out
$ go1.6 tool pprof ./foo.test /tmp/cpu.out
(pprof) weblist # Immediately launches browser with html file that is 209KB
Contents of foo_test.go (could be anything):
package foo
import (
"bufio"
"io"
"strings"
"testing"
)
func BenchmarkFoo(b *testing.B) {
s := strings.Repeat("Hello, world!", 100000)
b.SetBytes(int64(len(s)))
for i := 0; i < b.N; i++ {
var r io.ByteReader
r = bufio.NewReader(strings.NewReader(s))
for {
_, err := r.ReadByte()
if err != nil {
if err == io.EOF {
break
}
b.Fatal(err)
}
}
}
}
Reactions are currently unavailable