You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, may I ask why when new reset context, it set all properties to nil except for http.Request and http.ResponseWriter? What would be the problem if the implementation is the same as method NewContext?
echo.context is reused for http requests and between each request we need to reset it so there would not be data leaking from one request to other. We avoid using NewContext as much as possible to avoid allocating memory.
Activity
aldas commentedon Dec 5, 2023
echo.contextis reused for http requests and between each request we need to reset it so there would not be data leaking from one request to other. We avoid usingNewContextas much as possible to avoid allocating memory.This happens here:
echo/echo.go
Lines 648 to 652 in 584cb85
and at the end of
ServeHTTPthat context is put back to pool to be used for another request.