Fixes #65328
Change-Id: I11242be93a95e117a6758ac037e143c3b38aa71c
Reviewed-on: https://go-review.googlesource.com/c/go/+/597980
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
// }
// defer f.Close() // error handling omitted for example
// runtime.GC() // get up-to-date statistics
-// if err := pprof.WriteHeapProfile(f); err != nil {
+// // Lookup("allocs") creates a profile similar to go test -memprofile.
+// // Alternatively, use Lookup("heap") for a profile
+// // that has inuse_space as the default index.
+// if err := pprof.Lookup("allocs").WriteTo(f, 0); err != nil {
// log.Fatal("could not write memory profile: ", err)
// }
// }