weblogs
weblogs copied to clipboard
memory used too larg
https://github.com/keep94/weblogs/blob/d380f9bf1ca810168b7f85c7a22fbcc18f753eeb/weblogs.go#L164
The Set method stores the "*http.Request" object in the map and does not release it actively. If the "context.Delete" delete "*http.Request" object is not displayed, memory leak will result.
Thank you for pointing this out.
Wrapping your handler in a context.ClearHandler() should free up anything associated with the request object. Use like this:
handler := context.ClearHandler(weblogs.Handler(http.DefaultServeMux)) http.ListenAndServe(":80", handler)
If you still see memory leaking even using context.ClearHandler() please explain more.