mirror of
https://github.com/python/cpython.git
synced 2025-09-14 04:37:29 +00:00
Deallocate content of the dict free list on interpreter shutdown
This commit is contained in:
parent
8352585909
commit
f75dbef208
4 changed files with 17 additions and 0 deletions
|
@ -130,6 +130,7 @@ PyAPI_FUNC(void) _PyImport_Fini(void);
|
||||||
PyAPI_FUNC(void) PyMethod_Fini(void);
|
PyAPI_FUNC(void) PyMethod_Fini(void);
|
||||||
PyAPI_FUNC(void) PyFrame_Fini(void);
|
PyAPI_FUNC(void) PyFrame_Fini(void);
|
||||||
PyAPI_FUNC(void) PyCFunction_Fini(void);
|
PyAPI_FUNC(void) PyCFunction_Fini(void);
|
||||||
|
PyAPI_FUNC(void) PyDict_Fini(void);
|
||||||
PyAPI_FUNC(void) PyTuple_Fini(void);
|
PyAPI_FUNC(void) PyTuple_Fini(void);
|
||||||
PyAPI_FUNC(void) PyList_Fini(void);
|
PyAPI_FUNC(void) PyList_Fini(void);
|
||||||
PyAPI_FUNC(void) PySet_Fini(void);
|
PyAPI_FUNC(void) PySet_Fini(void);
|
||||||
|
|
|
@ -12,6 +12,9 @@ What's New in Python 2.6 alpha 1?
|
||||||
Core and builtins
|
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
|
- Limit free list of method and builtin function objects to 256 entries
|
||||||
each.
|
each.
|
||||||
|
|
||||||
|
|
|
@ -205,6 +205,18 @@ show_alloc(void)
|
||||||
static PyDictObject *free_list[PyDict_MAXFREELIST];
|
static PyDictObject *free_list[PyDict_MAXFREELIST];
|
||||||
static int numfree = 0;
|
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 *
|
PyObject *
|
||||||
PyDict_New(void)
|
PyDict_New(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -473,6 +473,7 @@ Py_Finalize(void)
|
||||||
PyString_Fini();
|
PyString_Fini();
|
||||||
PyInt_Fini();
|
PyInt_Fini();
|
||||||
PyFloat_Fini();
|
PyFloat_Fini();
|
||||||
|
PyDict_Fini();
|
||||||
|
|
||||||
#ifdef Py_USING_UNICODE
|
#ifdef Py_USING_UNICODE
|
||||||
/* Cleanup Unicode implementation */
|
/* Cleanup Unicode implementation */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue