diff options
author | Guido van Rossum <guido@python.org> | 1997-08-05 02:16:08 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-08-05 02:16:08 (GMT) |
commit | fbbd57e4ca4250e27b564d989a75caa0b1a4a9b5 (patch) | |
tree | 7e18c422e7879dc136a85dbc5db37727c785ab08 /Objects/tupleobject.c | |
parent | 971a7aaeac7b9c817ca68f11701b97bbd9aa54ab (diff) | |
download | cpython-fbbd57e4ca4250e27b564d989a75caa0b1a4a9b5.zip cpython-fbbd57e4ca4250e27b564d989a75caa0b1a4a9b5.tar.gz cpython-fbbd57e4ca4250e27b564d989a75caa0b1a4a9b5.tar.bz2 |
Added _Fini() routines to free up some memory
Diffstat (limited to 'Objects/tupleobject.c')
-rw-r--r-- | Objects/tupleobject.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c index 7dc4dc8..0faedb4 100644 --- a/Objects/tupleobject.c +++ b/Objects/tupleobject.c @@ -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 +} |