From: guoguangwu Date: Tue, 26 Mar 2024 06:38:55 +0000 (+0000) Subject: cmd/link: close memory profile X-Git-Tag: go1.23rc1~765 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=8bf9f4bb66785bbb8ccfdfaafbc79b6b17f66743;p=gostls13.git cmd/link: close memory profile Change-Id: If17e982dd0272e90972d2d4a94b1a744343ae2ec GitHub-Last-Rev: c8d03566b3e66a6de58e778102fa60f5d46ab2d9 GitHub-Pull-Request: golang/go#66531 Reviewed-on: https://go-review.googlesource.com/c/go/+/574335 Reviewed-by: Cherry Mui Reviewed-by: Than McIntosh LUCI-TryBot-Result: Go LUCI Auto-Submit: Than McIntosh --- diff --git a/src/cmd/link/internal/ld/main.go b/src/cmd/link/internal/ld/main.go index 13077668e7..5a4d7f9451 100644 --- a/src/cmd/link/internal/ld/main.go +++ b/src/cmd/link/internal/ld/main.go @@ -519,6 +519,10 @@ func startProfile() { if err := pprof.Lookup("heap").WriteTo(f, writeLegacyFormat); err != nil { log.Fatalf("%v", err) } + // Close the file after writing the profile. + if err := f.Close(); err != nil { + log.Fatalf("could not close %v: %v", *memprofile, err) + } }) } }