diff --git a/ipn/ipnlocal/c2n_pprof.go b/ipn/ipnlocal/c2n_pprof.go index 9341548ee..aacdbbc02 100644 --- a/ipn/ipnlocal/c2n_pprof.go +++ b/ipn/ipnlocal/c2n_pprof.go @@ -7,11 +7,17 @@ package ipnlocal import ( "net/http" + "runtime" "runtime/pprof" + "strconv" ) func init() { c2nLogHeap = func(w http.ResponseWriter, r *http.Request) { + // Support same optional gc parameter as net/http/pprof: + if gc, _ := strconv.Atoi(r.FormValue("gc")); gc > 0 { + runtime.GC() + } pprof.WriteHeapProfile(w) } }