mirror of
https://github.com/python/cpython.git
synced 2025-07-09 20:35:26 +00:00
Kill all local variables on function return. This closes a gigantic
leak of memory and file descriptors (thanks for Roj for reporting that!). Alas, the speed goes down by 5%. :-(
This commit is contained in:
parent
a04d47b319
commit
a4240132ec
1 changed files with 12 additions and 0 deletions
|
@ -1696,6 +1696,18 @@ eval_code2(co, globals, locals,
|
|||
why = WHY_EXCEPTION;
|
||||
}
|
||||
}
|
||||
|
||||
/* Kill all local variables */
|
||||
|
||||
{
|
||||
int i;
|
||||
for (i = co->co_nlocals; --i >= 0; ++fastlocals) {
|
||||
if (*fastlocals != NULL) {
|
||||
DECREF(*fastlocals);
|
||||
*fastlocals = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Restore previous frame and release the current one */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue