| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 97f762a commit 5e5833c
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1125,13 +1125,15 @@ finalize_garbage(PyThreadState *tstate, PyGC_Head *collectable) | |||
| 1125 | 1125 | * tricky business as the lists can be changing and we don't know which | |
| 1126 | 1126 | * objects may be freed. It is possible I screwed something up here. | |
| 1127 | 1127 | */ | |
| 1128 | - static void | ||
| 1128 | + static uintptr_t | ||
| 1129 | 1129 | delete_garbage(PyThreadState *tstate, GCState *gcstate, | |
| 1130 | 1130 | PyGC_Head *collectable, PyGC_Head *old) | |
| 1131 | 1131 | { | |
| 1132 | + uintptr_t deleted = 0; | ||
| 1132 | 1133 | assert(!_PyErr_Occurred(tstate)); | |
| 1133 | 1134 | ||
| 1134 | 1135 | while (!gc_list_is_empty(collectable)) { | |
| 1136 | + deleted++; | ||
| 1135 | 1137 | PyGC_Head *gc = GC_NEXT(collectable); | |
| 1136 | 1138 | PyObject *op = FROM_GC(gc); | |
| 1137 | 1139 | ||
@@ -1162,6 +1164,7 @@ delete_garbage(PyThreadState *tstate, GCState *gcstate, | |||
| 1162 | 1164 | gc_list_move(gc, old); | |
| 1163 | 1165 | } | |
| 1164 | 1166 | } | |
| 1167 | + return deleted; | ||
| 1165 | 1168 | } | |
| 1166 | 1169 | ||
| 1167 | 1170 | /* Clear all free lists | |
@@ -1639,8 +1642,7 @@ gc_collect_region(PyThreadState *tstate, | |||
| 1639 | 1642 | * the reference cycles to be broken. It may also cause some objects | |
| 1640 | 1643 | * in finalizers to be freed. | |
| 1641 | 1644 | */ | |
| 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); | ||
| 1644 | 1646 | validate_consistent_old_space(to); | |
| 1645 | 1647 | ||
| 1646 | 1648 | /* Collect statistics on uncollectable objects found and print | |
| Back | FazBrowse Home | New Git URL |
0 commit comments