fix: close profiles (#307)

This commit is contained in:
guangwu 2024-04-29 05:47:15 +08:00 committed by GitHub
parent 48a9ee9643
commit 6793ff4a0e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -46,11 +46,13 @@ func main() {
if err != nil {
panic(err)
}
defer f.Close()
defer pprof.StopCPUProfile()
memProf, err := os.Create("mem.prof")
if err != nil {
panic(err)
}
defer memProf.Close()
defer pprof.WriteHeapProfile(memProf)
}