diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c index bf61cad..31bf471 100644 --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -753,9 +753,13 @@ delete_garbage(PyGC_Head *collectable, PyGC_Head *old) * Allocated items in the free list may keep a pymalloc arena occupied. * Clearing the free lists may give back memory to the OS earlier. */ +#include static void clear_freelists(void) { + int t1, t; + float tsec; + t1 = clock(); (void)PyMethod_ClearFreeList(); (void)PyFrame_ClearFreeList(); (void)PyCFunction_ClearFreeList(); @@ -765,6 +769,9 @@ clear_freelists(void) (void)PyDict_ClearFreeList(); (void)PyList_ClearFreeList(); (void)PySet_ClearFreeList(); + t = clock() - t1; + tsec = (1000 * (float)t) / CLOCKS_PER_SEC; + printf("cleared free lists in %i clock ticks (%fms)\n", t, tsec); } static double