mirror of
https://github.com/python/cpython.git
synced 2025-11-11 14:44:57 +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
|
|
@ -1697,6 +1697,18 @@ eval_code2(co, globals, locals,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 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 */
|
/* Restore previous frame and release the current one */
|
||||||
|
|
||||||
current_frame = f->f_back;
|
current_frame = f->f_back;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue