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:
Guido van Rossum 1997-01-21 21:18:36 +00:00
parent a04d47b319
commit a4240132ec
1 changed files with 12 additions and 0 deletions

View File

@ -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 */