cmd/link: close memory profile

Signed-off-by: guoguangwu <guoguangwug@gmail.com>
This commit is contained in:
guoguangwu 2024-03-26 14:30:36 +08:00
parent f6b93a4c35
commit c8d03566b3

View file

@ -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)
}
})
}
}