Skip to content

Commit d7ea9ff

Browse files
seankhliaogopherbot
authored andcommitted
runtime/pprof: note different between go test -memprofile and WriteHeapProfile
Fixes #65328 Change-Id: I11242be93a95e117a6758ac037e143c3b38aa71c Reviewed-on: https://go-review.googlesource.com/c/go/+/597980 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Carlos Amedee <[email protected]> Reviewed-by: Cherry Mui <[email protected]> Auto-Submit: Michael Pratt <[email protected]>
1 parent 80d306d commit d7ea9ff

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/runtime/pprof/pprof.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@
4444
// }
4545
// defer f.Close() // error handling omitted for example
4646
// runtime.GC() // get up-to-date statistics
47-
// if err := pprof.WriteHeapProfile(f); err != nil {
47+
// // Lookup("allocs") creates a profile similar to go test -memprofile.
48+
// // Alternatively, use Lookup("heap") for a profile
49+
// // that has inuse_space as the default index.
50+
// if err := pprof.Lookup("allocs").WriteTo(f, 0); err != nil {
4851
// log.Fatal("could not write memory profile: ", err)
4952
// }
5053
// }

0 commit comments

Comments
 (0)