tango
tango copied to clipboard
struct context maybe cause memory leak?
memory leak in this case:
24.51MB 1.77% 20.68% 327.24MB 23.58% net/http.readRequest
258.23MB 18.61% 39.29% 283.23MB 20.41% net/textproto.(*Reader).ReadMIMEHeader
see more: https://github.com/gorilla/sessions see more: https://pathbox.github.io/2017/05/27/find-the-reason-memory-leak/
Important Note: If you aren't using gorilla/mux, you need to wrap your handlers with
context.ClearHandler or else you will leak memory! An easy way to do this is to wrap the top-level mux when calling http.ListenAndServe:
http.ListenAndServe(":8080", context.ClearHandler(http.DefaultServeMux))
The ClearHandler function is provided by the gorilla/context package.
More examples are available on the Gorilla website.
Could you give more testing details?