Skip to content

Commit 6da1198

Browse files
committed
feat(debug): gc
1 parent 4c62444 commit 6da1198

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

services/profiling/pprof.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
log "github.com/sirupsen/logrus"
77
"net/http"
88
"net/http/pprof"
9+
"runtime"
910
)
1011

1112
func StartProfiling() {
@@ -21,6 +22,10 @@ func StartProfiling() {
2122
mux.HandleFunc("/debug/pprof/profile", pprof.Profile)
2223
mux.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
2324
mux.HandleFunc("/debug/pprof/trace", pprof.Trace)
25+
mux.HandleFunc("/debug/gc", func(w http.ResponseWriter, r *http.Request) {
26+
runtime.GC()
27+
w.WriteHeader(http.StatusNoContent)
28+
})
2429

2530
go func() {
2631
log.WithFields(log.Fields{

0 commit comments

Comments
 (0)