]> granicus.if.org Git - python/commitdiff
Finalize the freelist of list objects.
authorRaymond Hettinger <python@rcn.com>
Thu, 7 Oct 2004 03:58:07 +0000 (03:58 +0000)
committerRaymond Hettinger <python@rcn.com>
Thu, 7 Oct 2004 03:58:07 +0000 (03:58 +0000)
Include/pythonrun.h
Objects/listobject.c
Python/pythonrun.c

index 145c009303bd9c8dd301a67a4e2deec98b032b8f..33497ceafca22f9bbcf7c821b30a52a72cb4ae7a 100644 (file)
@@ -113,6 +113,7 @@ PyAPI_FUNC(void) PyMethod_Fini(void);
 PyAPI_FUNC(void) PyFrame_Fini(void);
 PyAPI_FUNC(void) PyCFunction_Fini(void);
 PyAPI_FUNC(void) PyTuple_Fini(void);
+PyAPI_FUNC(void) PyList_Fini(void);
 PyAPI_FUNC(void) PyString_Fini(void);
 PyAPI_FUNC(void) PyInt_Fini(void);
 PyAPI_FUNC(void) PyFloat_Fini(void);
index 44616e56a031be77b884cc214d6f2d6153bba3fd..08ab0951c9bda74303aca0e081ef3daccbfabbca 100644 (file)
@@ -68,6 +68,19 @@ list_resize(PyListObject *self, int newsize)
 static PyListObject *free_lists[MAXFREELISTS];
 static int num_free_lists = 0;
 
+void
+PyList_Fini(void)
+{
+       PyListObject *op;
+
+       while (num_free_lists) {
+               num_free_lists--;
+               op = free_lists[num_free_lists]; 
+               assert(PyList_CheckExact(op));
+               PyObject_GC_Del(op);
+       }
+}
+
 PyObject *
 PyList_New(int size)
 {
index 917f2be00b0eb61e96d2e8cdb773101a4912b83a..06bec1e03860a47a16b61d8a0cbd3e6795f13681 100644 (file)
@@ -416,6 +416,7 @@ Py_Finalize(void)
        PyFrame_Fini();
        PyCFunction_Fini();
        PyTuple_Fini();
+       PyList_Fini();
        PyString_Fini();
        PyInt_Fini();
        PyFloat_Fini();