Implemented Martin's suggestion to clear the free lists during the garbage collection of the highest generation.
diff --git a/Include/classobject.h b/Include/classobject.h
index 8f8db7d..118dd09 100644
--- a/Include/classobject.h
+++ b/Include/classobject.h
@@ -74,6 +74,7 @@
PyAPI_FUNC(int) PyClass_IsSubclass(PyObject *, PyObject *);
+PyAPI_FUNC(int) PyMethod_ClearFreeList(void);
#ifdef __cplusplus
}
diff --git a/Include/frameobject.h b/Include/frameobject.h
index 794f651..297b66d 100644
--- a/Include/frameobject.h
+++ b/Include/frameobject.h
@@ -75,6 +75,8 @@
PyAPI_FUNC(void) PyFrame_LocalsToFast(PyFrameObject *, int);
PyAPI_FUNC(void) PyFrame_FastToLocals(PyFrameObject *);
+PyAPI_FUNC(int) PyFrame_ClearFreeList(void);
+
#ifdef __cplusplus
}
#endif
diff --git a/Include/methodobject.h b/Include/methodobject.h
index 810a69c..6e160b6 100644
--- a/Include/methodobject.h
+++ b/Include/methodobject.h
@@ -85,6 +85,8 @@
PyObject *m_module; /* The __module__ attribute, can be anything */
} PyCFunctionObject;
+PyAPI_FUNC(int) PyCFunction_ClearFreeList(void);
+
#ifdef __cplusplus
}
#endif
diff --git a/Include/tupleobject.h b/Include/tupleobject.h
index 1b51b1b..58479ee 100644
--- a/Include/tupleobject.h
+++ b/Include/tupleobject.h
@@ -52,6 +52,8 @@
/* Macro, *only* to be used to fill in brand new tuples */
#define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject *)(op))->ob_item[i] = v)
+PyAPI_FUNC(int) PyTuple_ClearFreeList(void);
+
#ifdef __cplusplus
}
#endif
diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h
index 8809b34..d7ed0fa 100644
--- a/Include/unicodeobject.h
+++ b/Include/unicodeobject.h
@@ -209,6 +209,7 @@
# define _PyUnicode_AsDefaultEncodedString _PyUnicodeUCS2_AsDefaultEncodedString
# define _PyUnicode_Fini _PyUnicodeUCS2_Fini
# define _PyUnicode_Init _PyUnicodeUCS2_Init
+# define PyUnicode_ClearFreeList PyUnicodeUCS2_ClearFreelist
# define _PyUnicode_IsAlpha _PyUnicodeUCS2_IsAlpha
# define _PyUnicode_IsDecimalDigit _PyUnicodeUCS2_IsDecimalDigit
# define _PyUnicode_IsDigit _PyUnicodeUCS2_IsDigit
@@ -295,6 +296,7 @@
# define _PyUnicode_AsDefaultEncodedString _PyUnicodeUCS4_AsDefaultEncodedString
# define _PyUnicode_Fini _PyUnicodeUCS4_Fini
# define _PyUnicode_Init _PyUnicodeUCS4_Init
+# define PyUnicode_ClearFreeList PyUnicodeUCS2_ClearFreelist
# define _PyUnicode_IsAlpha _PyUnicodeUCS4_IsAlpha
# define _PyUnicode_IsDecimalDigit _PyUnicodeUCS4_IsDecimalDigit
# define _PyUnicode_IsDigit _PyUnicodeUCS4_IsDigit
@@ -403,6 +405,8 @@
extern "C" {
#endif
+PyAPI_FUNC(int) PyUnicode_ClearFreeList(void);
+
/* --- Unicode Type ------------------------------------------------------- */
typedef struct {