fix: explicitly delete error references to prevent memory leaks
Add explicit "del error" statement to prevent reference cycles between exception objects and local variables. This helps the garbage collector promptly reclaim memory after request processing, which is especially important in high-traffic web applications where exception objects with traceback information can consume significant memory.
This commit is contained in:
parent
b78b5a210b
commit
9225f8bb28
1 changed files with 1 additions and 0 deletions
|
|
@ -1525,6 +1525,7 @@ class Flask(App):
|
|||
error = None
|
||||
|
||||
ctx.pop(error)
|
||||
del error
|
||||
|
||||
def __call__(
|
||||
self, environ: WSGIEnvironment, start_response: StartResponse
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue