Skip to content

Commit 7b3c380

Browse files
testwillgopherbot
authored andcommitted
cmd/link: close cpu profile
Change-Id: Ieaf1c165307a98d58c40d4d970eecfd6d74b2411 GitHub-Last-Rev: bd72710 GitHub-Pull-Request: #66736 Reviewed-on: https://go-review.googlesource.com/c/go/+/577416 Auto-Submit: Than McIntosh <[email protected]> Reviewed-by: Than McIntosh <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent c23579f commit 7b3c380

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/cmd/link/internal/ld/main.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,12 @@ func startProfile() {
499499
if err := pprof.StartCPUProfile(f); err != nil {
500500
log.Fatalf("%v", err)
501501
}
502-
AtExit(pprof.StopCPUProfile)
502+
AtExit(func() {
503+
pprof.StopCPUProfile()
504+
if err = f.Close(); err != nil {
505+
log.Fatalf("error closing cpu profile: %v", err)
506+
}
507+
})
503508
}
504509
if *memprofile != "" {
505510
if *memprofilerate != 0 {

0 commit comments

Comments
 (0)