Skip to content

Commit

Permalink
Merge pull request #17729 from testwill/close_profile
Browse files Browse the repository at this point in the history
fix: close profile in the mvccPutFunc func
  • Loading branch information
jmhbnz authored Apr 11, 2024
2 parents 8d3abed + 90152fe commit fa08f01
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/benchmark/cmd/mvcc-put.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func mvccPutFunc(_ *cobra.Command, _ []string) {
fmt.Fprintln(os.Stderr, "Failed to create a file for storing cpu profile result: ", err)
os.Exit(1)
}

defer f.Close()
err = pprof.StartCPUProfile(f)
if err != nil {
fmt.Fprintln(os.Stderr, "Failed to start cpu profile: ", err)
Expand All @@ -92,7 +92,7 @@ func mvccPutFunc(_ *cobra.Command, _ []string) {
fmt.Fprintln(os.Stderr, "Failed to create a file for storing heap profile result: ", err)
os.Exit(1)
}

defer f.Close()
defer func() {
err := pprof.WriteHeapProfile(f)
if err != nil {
Expand Down

0 comments on commit fa08f01

Please sign in to comment.