Skip to content

Commit

Permalink
fix: close profile in the mvccPutFunc func
Browse files Browse the repository at this point in the history
Signed-off-by: guoguangwu <guoguangwug@gmail.com>
  • Loading branch information
testwill committed Apr 8, 2024
1 parent 84e67ff commit 90152fe
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 90152fe

Please sign in to comment.