File tree Expand file tree Collapse file tree 4 files changed +17
-0
lines changed
Expand file tree Collapse file tree 4 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -130,6 +130,7 @@ PyAPI_FUNC(void) _PyImport_Fini(void);
130130PyAPI_FUNC (void ) PyMethod_Fini (void );
131131PyAPI_FUNC (void ) PyFrame_Fini (void );
132132PyAPI_FUNC (void ) PyCFunction_Fini (void );
133+ PyAPI_FUNC (void ) PyDict_Fini (void );
133134PyAPI_FUNC (void ) PyTuple_Fini (void );
134135PyAPI_FUNC (void ) PyList_Fini (void );
135136PyAPI_FUNC (void ) PySet_Fini (void );
Original file line number Diff line number Diff line change @@ -12,6 +12,9 @@ What's New in Python 2.6 alpha 1?
1212Core and builtins
1313-----------------
1414
15+ - Fixed a minor memory leak in dictobject.c. The content of the free
16+ list was not freed on interpreter shutdown.
17+
1518- Limit free list of method and builtin function objects to 256 entries
1619 each.
1720
Original file line number Diff line number Diff line change @@ -205,6 +205,18 @@ show_alloc(void)
205205static PyDictObject * free_list [PyDict_MAXFREELIST ];
206206static int numfree = 0 ;
207207
208+ void
209+ PyDict_Fini (void )
210+ {
211+ PyListObject * op ;
212+
213+ while (numfree ) {
214+ op = free_list [numfree -- ];
215+ assert (PyDict_CheckExact (op ));
216+ PyObject_GC_Del (op );
217+ }
218+ }
219+
208220PyObject *
209221PyDict_New (void )
210222{
Original file line number Diff line number Diff line change @@ -473,6 +473,7 @@ Py_Finalize(void)
473473 PyString_Fini ();
474474 PyInt_Fini ();
475475 PyFloat_Fini ();
476+ PyDict_Fini ();
476477
477478#ifdef Py_USING_UNICODE
478479 /* Cleanup Unicode implementation */
You can’t perform that action at this time.
0 commit comments