Commit f2d7e66e authored by Roland Illig's avatar Roland Illig Committed by Brad Fitzpatrick

runtime/pprof: fix resource leak in documentation

Fixes #26970

Change-Id: I0f2695434a53550cf84f702e9d8d02a37448d396
Reviewed-on: https://go-review.googlesource.com/129195Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 3879ea54
......@@ -28,6 +28,7 @@
// if err != nil {
// log.Fatal("could not create CPU profile: ", err)
// }
// defer f.Close()
// if err := pprof.StartCPUProfile(f); err != nil {
// log.Fatal("could not start CPU profile: ", err)
// }
......@@ -41,11 +42,11 @@
// if err != nil {
// log.Fatal("could not create memory profile: ", err)
// }
// defer f.Close()
// runtime.GC() // get up-to-date statistics
// if err := pprof.WriteHeapProfile(f); err != nil {
// log.Fatal("could not write memory profile: ", err)
// }
// f.Close()
// }
// }
//
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment