Memory Profiling of http


(Deepika Bhavnani) #1

Hello All,

I was trying to understand the memory leaks in my application, and saw memory allocations from TLS were not freed - Several go routines pointing to memory allocated inside TLS section created by net/http.(*persistConn).addTLS

I wrote small code to understand this https://play.golang.org/p/om0A-gkJzFt.
On executing this code with GODEBUG=allocfreetrace=1 env enabled I noted that memory dump had all tracealloc and tracefree was not called even after application terminated.

Am I missing some step here? Or there is a memory leak in basic application code as well?


(Mihails Atamanskis) #2

In golang not so easy get memory leaks… usually and easier get goroutines leaks.
To profile your apps you can easy implement Grafana with InfluxDB. If need I can pack all go code for metric with Grafana handler like a module and push it to some git