Mercurial > cpython-lru_cache-weakref
diff Objects/methodobject.c @ 45341:65ae68c7aca3 legacy-trunk
Implemented Martin's suggestion to clear the free lists during the garbage collection of the highest generation.
| author | Christian Heimes <christian@cheimes.de> |
|---|---|
| date | Thu, 14 Feb 2008 12:47:33 +0000 |
| parents | 920a7633ae08 |
| children | 860e23a61e55 |
line wrap: on
line diff
--- a/Objects/methodobject.c Thu Feb 14 12:05:42 2008 +0000 +++ b/Objects/methodobject.c Thu Feb 14 12:47:33 2008 +0000 @@ -353,9 +353,11 @@ /* 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 @@ 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(),
