Skip to content

Commit 1452378

Browse files
committed
Avoid repeated collection of the young gen
1 parent a2d9e3e commit 1452378

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Python/gc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1565,6 +1565,7 @@ gc_collect_increment(PyThreadState *tstate, struct gc_collection_stats *stats)
15651565
GC_STAT_ADD(1, collections, 1);
15661566
GCState *gcstate = &tstate->interp->gc;
15671567
gcstate->work_to_do += gcstate->young.count;
1568+
gcstate->young.count = 0;
15681569
if (gcstate->phase == GC_PHASE_MARK) {
15691570
Py_ssize_t objects_marked = mark_at_start(tstate);
15701571
GC_STAT_ADD(1, objects_transitively_reachable, objects_marked);
@@ -1585,7 +1586,6 @@ gc_collect_increment(PyThreadState *tstate, struct gc_collection_stats *stats)
15851586
gc_list_set_space(&gcstate->young.head, gcstate->visited_space);
15861587
untrack_tuples(&gcstate->young.head);
15871588
gc_list_merge(&gcstate->young.head, &increment);
1588-
gcstate->young.count = 0;
15891589
gc_list_validate_space(&increment, gcstate->visited_space);
15901590
Py_ssize_t increment_size = 0;
15911591
while (increment_size < gcstate->work_to_do) {

0 commit comments

Comments
 (0)