]> source.dussan.org Git - gitea.git/commitdiff
Include heap pprof in diagnosis report to help debugging memory leaks (#28596) (...
authorGiteabot <teabot@gitea.io>
Sun, 24 Dec 2023 01:18:43 +0000 (09:18 +0800)
committerGitHub <noreply@github.com>
Sun, 24 Dec 2023 01:18:43 +0000 (09:18 +0800)
routers/web/admin/diagnosis.go

index 5637894e6de25f0f3fba89c4ff46fe11f41f06d8..2d550125d550c26ee952c46364c718afce7a3ddf 100644 (file)
@@ -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)
 }