diff options
author | Christian Heimes <christian@cheimes.de> | 2008-02-14 12:47:33 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2008-02-14 12:47:33 (GMT) |
commit | 3b718a79af900fdacaf0b825137f69eadc753765 (patch) | |
tree | 71cbe9fcb7b94a2611e5f62cf329285270615e22 /Objects/methodobject.c | |
parent | 50361d4d9b3e8729aa535c3dfde3d9d2ad899d47 (diff) | |
download | cpython-3b718a79af900fdacaf0b825137f69eadc753765.zip cpython-3b718a79af900fdacaf0b825137f69eadc753765.tar.gz cpython-3b718a79af900fdacaf0b825137f69eadc753765.tar.bz2 |
Implemented Martin's suggestion to clear the free lists during the garbage collection of the highest generation.
Diffstat (limited to 'Objects/methodobject.c')
-rw-r--r-- | Objects/methodobject.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Objects/methodobject.c b/Objects/methodobject.c index 0d9cf1c..d661c47 100644 --- a/Objects/methodobject.c +++ b/Objects/methodobject.c @@ -353,9 +353,11 @@ Py_FindMethod(PyMethodDef *methods, PyObject *self, const char *name) /* Clear out the free list */ -void -PyCFunction_Fini(void) +int +PyCFunction_ClearFreeList(void) { + int freelist_size = numfree; + while (free_list) { PyCFunctionObject *v = free_list; free_list = (PyCFunctionObject *)(v->m_self); @@ -363,6 +365,13 @@ PyCFunction_Fini(void) numfree--; } assert(numfree == 0); + return freelist_size; +} + +void +PyCFunction_Fini(void) +{ + (void)PyCFunction_ClearFreeList(); } /* PyCFunction_New() is now just a macro that calls PyCFunction_NewEx(), |