Skip to content

Commit

Permalink
Include heap pprof in diagnosis report to help debugging memory leaks (
Browse files Browse the repository at this point in the history
  • Loading branch information
wxiaoguang authored Dec 23, 2023
1 parent 33439b7 commit 330aab4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions routers/web/admin/diagnosis.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,11 @@ func MonitorDiagnosis(ctx *context.Context) {
return
}
_ = pprof.Lookup("goroutine").WriteTo(f, 1)

f, err = zipWriter.CreateHeader(&zip.FileHeader{Name: "heap.dat", Method: zip.Deflate, Modified: time.Now()})
if err != nil {
ctx.ServerError("Failed to create zip file", err)
return
}
_ = pprof.Lookup("heap").WriteTo(f, 0)
}

0 comments on commit 330aab4

Please sign in to comment.