Skip to content

Commit bbf4702

Browse files
wxiaoguangGiteaBot
authored andcommitted
Include heap pprof in diagnosis report to help debugging memory leaks (go-gitea#28596)
1 parent 564068a commit bbf4702

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

routers/web/admin/diagnosis.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,11 @@ func MonitorDiagnosis(ctx *context.Context) {
5858
return
5959
}
6060
_ = pprof.Lookup("goroutine").WriteTo(f, 1)
61+
62+
f, err = zipWriter.CreateHeader(&zip.FileHeader{Name: "heap.dat", Method: zip.Deflate, Modified: time.Now()})
63+
if err != nil {
64+
ctx.ServerError("Failed to create zip file", err)
65+
return
66+
}
67+
_ = pprof.Lookup("heap").WriteTo(f, 0)
6168
}

0 commit comments

Comments
 (0)