Mercurial > cpython-lru_cache-weakref
diff Python/ceval.c @ 5023:75c1ee882a4a legacy-trunk
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%. :-(
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Tue, 21 Jan 1997 21:18:36 +0000 |
| parents | c22add364351 |
| children | fde73467b584 |
line wrap: on
line diff
--- a/Python/ceval.c Tue Jan 21 16:12:09 1997 +0000 +++ b/Python/ceval.c Tue Jan 21 21:18:36 1997 +0000 @@ -1696,6 +1696,18 @@ 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 */
