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/dictobject.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/dictobject.c')
-rw-r--r-- | Objects/dictobject.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 82735e6..f8f072d 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -217,16 +217,23 @@ show_track(void) static PyDictObject *free_list[PyDict_MAXFREELIST]; static int numfree = 0; -void -PyDict_Fini(void) +int +PyDict_ClearFreeList(void) { PyDictObject *op; - + int ret = numfree; while (numfree) { op = free_list[--numfree]; assert(PyDict_CheckExact(op)); PyObject_GC_Del(op); } + return ret; +} + +void +PyDict_Fini(void) +{ + PyDict_ClearFreeList(); } PyObject * |