summaryrefslogtreecommitdiffstats
path: root/Objects/dictobject.c
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2008-02-08 00:11:31 (GMT)
committerChristian Heimes <christian@cheimes.de>2008-02-08 00:11:31 (GMT)
commitf75dbef208673865b31d32d5a2196b15b1b03024 (patch)
tree45cbf29ffd048f33fa21b1aae333d50209b7a6ea /Objects/dictobject.c
parent83525859092e4bc2605503dc02abc8e27f2820b0 (diff)
downloadcpython-f75dbef208673865b31d32d5a2196b15b1b03024.zip
cpython-f75dbef208673865b31d32d5a2196b15b1b03024.tar.gz
cpython-f75dbef208673865b31d32d5a2196b15b1b03024.tar.bz2
Deallocate content of the dict free list on interpreter shutdown
Diffstat (limited to 'Objects/dictobject.c')
-rw-r--r--Objects/dictobject.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index 82d247f..9e2b944 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -205,6 +205,18 @@ show_alloc(void)
static PyDictObject *free_list[PyDict_MAXFREELIST];
static int numfree = 0;
+void
+PyDict_Fini(void)
+{
+ PyListObject *op;
+
+ while (numfree) {
+ op = free_list[numfree--];
+ assert(PyDict_CheckExact(op));
+ PyObject_GC_Del(op);
+ }
+}
+
PyObject *
PyDict_New(void)
{