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

Merge pull request #4096 from jianzhiyao/request_context

fix memory leak of request context
This commit is contained in:
Ming Deng
2020-07-27 18:04:37 +08:00
committed by GitHub
3 changed files with 30 additions and 0 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)
}