diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-11-14 23:00:12 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-11-14 23:00:12 (GMT) |
commit | 9a812cbc899caeb25ab523e904dfac02e4da2999 (patch) | |
tree | d54805ed801f969bd6bbfc08640c9dfba076b90c /Objects/listobject.c | |
parent | d8b9ae6e8f6d9a562ccdf4700d24c0155979fb4f (diff) | |
download | cpython-9a812cbc899caeb25ab523e904dfac02e4da2999.zip cpython-9a812cbc899caeb25ab523e904dfac02e4da2999.tar.gz cpython-9a812cbc899caeb25ab523e904dfac02e4da2999.tar.bz2 |
Issue #13389: Full garbage collection passes now clear the freelists for
list and dict objects. They already cleared other freelists in the
interpreter.
Diffstat (limited to 'Objects/listobject.c')
-rw-r--r-- | Objects/listobject.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c index 69a632d..6f1edc5 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -97,16 +97,23 @@ show_alloc(void) static PyListObject *free_list[PyList_MAXFREELIST]; static int numfree = 0; -void -PyList_Fini(void) +int +PyList_ClearFreeList(void) { PyListObject *op; - + int ret = numfree; while (numfree) { op = free_list[--numfree]; assert(PyList_CheckExact(op)); PyObject_GC_Del(op); } + return ret; +} + +void +PyList_Fini(void) +{ + PyList_ClearFreeList(); } PyObject * |