Issue #13389: Full garbage collection passes now clear the freelists for
list and dict objects. They already cleared other freelists in the interpreter.
This commit is contained in:
parent
d8b9ae6e8f
commit
9a812cbc89
|
@ -209,3 +209,10 @@ Dictionary Objects
|
||||||
for key, value in seq2:
|
for key, value in seq2:
|
||||||
if override or key not in a:
|
if override or key not in a:
|
||||||
a[key] = value
|
a[key] = value
|
||||||
|
|
||||||
|
|
||||||
|
.. c:function:: int PyDict_ClearFreeList()
|
||||||
|
|
||||||
|
Clear the free list. Return the total number of freed items.
|
||||||
|
|
||||||
|
.. versionadded:: 3.3
|
||||||
|
|
|
@ -142,3 +142,10 @@ List Objects
|
||||||
|
|
||||||
Return a new tuple object containing the contents of *list*; equivalent to
|
Return a new tuple object containing the contents of *list*; equivalent to
|
||||||
``tuple(list)``.
|
``tuple(list)``.
|
||||||
|
|
||||||
|
|
||||||
|
.. c:function:: int PyList_ClearFreeList()
|
||||||
|
|
||||||
|
Clear the free list. Return the total number of freed items.
|
||||||
|
|
||||||
|
.. versionadded:: 3.3
|
||||||
|
|
|
@ -129,6 +129,8 @@ PyAPI_FUNC(int) _PyDict_Contains(PyObject *mp, PyObject *key, Py_hash_t hash);
|
||||||
PyAPI_FUNC(PyObject *) _PyDict_NewPresized(Py_ssize_t minused);
|
PyAPI_FUNC(PyObject *) _PyDict_NewPresized(Py_ssize_t minused);
|
||||||
PyAPI_FUNC(void) _PyDict_MaybeUntrack(PyObject *mp);
|
PyAPI_FUNC(void) _PyDict_MaybeUntrack(PyObject *mp);
|
||||||
PyAPI_FUNC(int) _PyDict_HasOnlyStringKeys(PyObject *mp);
|
PyAPI_FUNC(int) _PyDict_HasOnlyStringKeys(PyObject *mp);
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) PyDict_ClearFreeList(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* PyDict_Update(mp, other) is equivalent to PyDict_Merge(mp, other, 1). */
|
/* PyDict_Update(mp, other) is equivalent to PyDict_Merge(mp, other, 1). */
|
||||||
|
|
|
@ -62,6 +62,8 @@ PyAPI_FUNC(int) PyList_Reverse(PyObject *);
|
||||||
PyAPI_FUNC(PyObject *) PyList_AsTuple(PyObject *);
|
PyAPI_FUNC(PyObject *) PyList_AsTuple(PyObject *);
|
||||||
#ifndef Py_LIMITED_API
|
#ifndef Py_LIMITED_API
|
||||||
PyAPI_FUNC(PyObject *) _PyList_Extend(PyListObject *, PyObject *);
|
PyAPI_FUNC(PyObject *) _PyList_Extend(PyListObject *, PyObject *);
|
||||||
|
|
||||||
|
PyAPI_FUNC(int) PyList_ClearFreeList(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Macro, trading safety for speed */
|
/* Macro, trading safety for speed */
|
||||||
|
|
|
@ -10,6 +10,10 @@ What's New in Python 3.3 Alpha 1?
|
||||||
Core and Builtins
|
Core and Builtins
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- Issue #13389: Full garbage collection passes now clear the freelists for
|
||||||
|
list and dict objects. They already cleared other freelists in the
|
||||||
|
interpreter.
|
||||||
|
|
||||||
- Issue #13327: Remove the need for an explicit None as the second argument
|
- Issue #13327: Remove the need for an explicit None as the second argument
|
||||||
to os.utime, os.lutimes, os.futimes, os.futimens, os.futimesat, in
|
to os.utime, os.lutimes, os.futimes, os.futimens, os.futimesat, in
|
||||||
order to update to the current time. Also added keyword argument
|
order to update to the current time. Also added keyword argument
|
||||||
|
|
|
@ -762,6 +762,8 @@ clear_freelists(void)
|
||||||
(void)PyTuple_ClearFreeList();
|
(void)PyTuple_ClearFreeList();
|
||||||
(void)PyUnicode_ClearFreeList();
|
(void)PyUnicode_ClearFreeList();
|
||||||
(void)PyFloat_ClearFreeList();
|
(void)PyFloat_ClearFreeList();
|
||||||
|
(void)PyList_ClearFreeList();
|
||||||
|
(void)PyDict_ClearFreeList();
|
||||||
}
|
}
|
||||||
|
|
||||||
static double
|
static double
|
||||||
|
|
|
@ -217,16 +217,23 @@ show_track(void)
|
||||||
static PyDictObject *free_list[PyDict_MAXFREELIST];
|
static PyDictObject *free_list[PyDict_MAXFREELIST];
|
||||||
static int numfree = 0;
|
static int numfree = 0;
|
||||||
|
|
||||||
void
|
int
|
||||||
PyDict_Fini(void)
|
PyDict_ClearFreeList(void)
|
||||||
{
|
{
|
||||||
PyDictObject *op;
|
PyDictObject *op;
|
||||||
|
int ret = numfree;
|
||||||
while (numfree) {
|
while (numfree) {
|
||||||
op = free_list[--numfree];
|
op = free_list[--numfree];
|
||||||
assert(PyDict_CheckExact(op));
|
assert(PyDict_CheckExact(op));
|
||||||
PyObject_GC_Del(op);
|
PyObject_GC_Del(op);
|
||||||
}
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PyDict_Fini(void)
|
||||||
|
{
|
||||||
|
PyDict_ClearFreeList();
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
|
|
|
@ -97,16 +97,23 @@ show_alloc(void)
|
||||||
static PyListObject *free_list[PyList_MAXFREELIST];
|
static PyListObject *free_list[PyList_MAXFREELIST];
|
||||||
static int numfree = 0;
|
static int numfree = 0;
|
||||||
|
|
||||||
void
|
int
|
||||||
PyList_Fini(void)
|
PyList_ClearFreeList(void)
|
||||||
{
|
{
|
||||||
PyListObject *op;
|
PyListObject *op;
|
||||||
|
int ret = numfree;
|
||||||
while (numfree) {
|
while (numfree) {
|
||||||
op = free_list[--numfree];
|
op = free_list[--numfree];
|
||||||
assert(PyList_CheckExact(op));
|
assert(PyList_CheckExact(op));
|
||||||
PyObject_GC_Del(op);
|
PyObject_GC_Del(op);
|
||||||
}
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PyList_Fini(void)
|
||||||
|
{
|
||||||
|
PyList_ClearFreeList();
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
|
|
Loading…
Reference in New Issue