mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Added _Fini() routines to free up some memory
This commit is contained in:
parent
971a7aaeac
commit
fbbd57e4ca
3 changed files with 47 additions and 1 deletions
|
@ -74,7 +74,8 @@ PyTuple_New(size)
|
|||
#ifdef COUNT_ALLOCS
|
||||
fast_tuple_allocs++;
|
||||
#endif
|
||||
} else
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
op = (PyTupleObject *) malloc(
|
||||
|
@ -467,3 +468,25 @@ _PyTuple_Resize(pv, newsize, last_is_sticky)
|
|||
sv->ob_size = newsize;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
PyTuple_Fini()
|
||||
{
|
||||
#if MAXSAVESIZE > 0
|
||||
int i;
|
||||
|
||||
Py_XDECREF(free_tuples[0]);
|
||||
free_tuples[0] = NULL;
|
||||
|
||||
for (i = 1; i < MAXSAVESIZE; i++) {
|
||||
PyTupleObject *p, *q;
|
||||
p = free_tuples[i];
|
||||
free_tuples[i] = NULL;
|
||||
while (p) {
|
||||
q = p;
|
||||
p = (PyTupleObject *)(p->ob_item[0]);
|
||||
PyMem_DEL(q);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue