1
0
mirror of https://github.com/astaxie/beego.git synced 2025-08-31 00:47:33 +00:00

fix memory leak of request context

This commit is contained in:
jianzhiyao
2020-07-25 00:00:34 +08:00
parent 9d936c58bf
commit cfff0f3b46
3 changed files with 40 additions and 2 deletions

View File

@@ -319,6 +319,10 @@ func (p *ControllerRegister) GetContext() *beecontext.Context {
// GiveBackContext put the ctx into pool so that it could be reuse
func (p *ControllerRegister) GiveBackContext(ctx *beecontext.Context) {
// clear input cached data
ctx.Input.Clear()
// clear output cached data
ctx.Output.Clear()
p.pool.Put(ctx)
}