@@ -1125,13 +1125,15 @@ finalize_garbage(PyThreadState *tstate, PyGC_Head *collectable)
11251125 * tricky business as the lists can be changing and we don't know which
11261126 * objects may be freed. It is possible I screwed something up here.
11271127 */
1128- static void
1128+ static uintptr_t
11291129delete_garbage (PyThreadState * tstate , GCState * gcstate ,
11301130 PyGC_Head * collectable , PyGC_Head * old )
11311131{
1132+ uintptr_t deleted = 0 ;
11321133 assert (!_PyErr_Occurred (tstate ));
11331134
11341135 while (!gc_list_is_empty (collectable )) {
1136+ deleted ++ ;
11351137 PyGC_Head * gc = GC_NEXT (collectable );
11361138 PyObject * op = FROM_GC (gc );
11371139
@@ -1162,6 +1164,7 @@ delete_garbage(PyThreadState *tstate, GCState *gcstate,
11621164 gc_list_move (gc , old );
11631165 }
11641166 }
1167+ return deleted ;
11651168}
11661169
11671170/* Clear all free lists
@@ -1639,8 +1642,7 @@ gc_collect_region(PyThreadState *tstate,
16391642 * the reference cycles to be broken. It may also cause some objects
16401643 * in finalizers to be freed.
16411644 */
1642- stats -> collected += gc_list_size (& final_unreachable );
1643- delete_garbage (tstate , gcstate , & final_unreachable , to );
1645+ stats -> collected += delete_garbage (tstate , gcstate , & final_unreachable , to );
16441646 validate_consistent_old_space (to );
16451647
16461648 /* Collect statistics on uncollectable objects found and print
0 commit comments