diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-12-24 03:06:02 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-23 19:06:02 +0000 |
commit | 330aab47b3e4d777a6e5a3f05351ceab92ee5562 (patch) | |
tree | 3e0d94624220114444a31b81f4259f9b37519f85 /routers | |
parent | 33439b733a4f69640350b9cda370963ebe9d1e0a (diff) | |
download | gitea-330aab47b3e4d777a6e5a3f05351ceab92ee5562.tar.gz gitea-330aab47b3e4d777a6e5a3f05351ceab92ee5562.zip |
Include heap pprof in diagnosis report to help debugging memory leaks (#28596)
Diffstat (limited to 'routers')
-rw-r--r-- | routers/web/admin/diagnosis.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/routers/web/admin/diagnosis.go b/routers/web/admin/diagnosis.go index 5637894e6d..2d550125d5 100644 --- a/routers/web/admin/diagnosis.go +++ b/routers/web/admin/diagnosis.go @@ -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) } |