[Python-checkins] r60661 - in python/trunk: Include/pythonrun.h Misc/NEWS Objects/dictobject.c Python/pythonrun.c
christian.heimes
python-checkins at python.org
Fri Feb 8 01:11:32 CET 2008
Author: christian.heimes
Date: Fri Feb 8 01:11:31 2008
New Revision: 60661
Modified:
python/trunk/Include/pythonrun.h
python/trunk/Misc/NEWS
python/trunk/Objects/dictobject.c
python/trunk/Python/pythonrun.c
Log:
Deallocate content of the dict free list on interpreter shutdown
Modified: python/trunk/Include/pythonrun.h
==============================================================================
--- python/trunk/Include/pythonrun.h (original)
+++ python/trunk/Include/pythonrun.h Fri Feb 8 01:11:31 2008
@@ -130,6 +130,7 @@
PyAPI_FUNC(void) PyMethod_Fini(void);
PyAPI_FUNC(void) PyFrame_Fini(void);
PyAPI_FUNC(void) PyCFunction_Fini(void);
+PyAPI_FUNC(void) PyDict_Fini(void);
PyAPI_FUNC(void) PyTuple_Fini(void);
PyAPI_FUNC(void) PyList_Fini(void);
PyAPI_FUNC(void) PySet_Fini(void);
Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS (original)
+++ python/trunk/Misc/NEWS Fri Feb 8 01:11:31 2008
@@ -12,6 +12,9 @@
Core and builtins
-----------------
+- Fixed a minor memory leak in dictobject.c. The content of the free
+ list was not freed on interpreter shutdown.
+
- Limit free list of method and builtin function objects to 256 entries
each.
Modified: python/trunk/Objects/dictobject.c
==============================================================================
--- python/trunk/Objects/dictobject.c (original)
+++ python/trunk/Objects/dictobject.c Fri Feb 8 01:11:31 2008
@@ -205,6 +205,18 @@
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)
{
Modified: python/trunk/Python/pythonrun.c
==============================================================================
--- python/trunk/Python/pythonrun.c (original)
+++ python/trunk/Python/pythonrun.c Fri Feb 8 01:11:31 2008
@@ -473,6 +473,7 @@
PyString_Fini();
PyInt_Fini();
PyFloat_Fini();
+ PyDict_Fini();
#ifdef Py_USING_UNICODE
/* Cleanup Unicode implementation */
More information about the Python-checkins
mailing list