Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 68fc90b

Browse files
committed
Move all work to do calculations to one place
1 parent a1a38c8 commit 68fc90b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Python/gc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,7 +1570,7 @@ assess_work_to_do(GCState *gcstate)
15701570
heap_fraction = max_heap_fraction;
15711571
}
15721572
gcstate->young.count = 0;
1573-
return new_objects + heap_fraction;
1573+
return new_objects + heap_fraction * 2;
15741574
}
15751575

15761576
static void
@@ -1617,6 +1617,7 @@ gc_collect_increment(PyThreadState *tstate, struct gc_collection_stats *stats)
16171617
increment_size += move_all_transitively_reachable(&working, &increment, gcstate->visited_space);
16181618
assert(working.top == NULL);
16191619
}
1620+
assert(increment_size == gc_list_size(&increment));
16201621
GC_STAT_ADD(1, objects_not_transitively_reachable, increment_size);
16211622
validate_list(&increment, collecting_clear_unreachable_clear);
16221623
gc_list_validate_space(&increment, gcstate->visited_space);
@@ -1625,7 +1626,6 @@ gc_collect_increment(PyThreadState *tstate, struct gc_collection_stats *stats)
16251626
gc_collect_region(tstate, &increment, &survivors, stats);
16261627
gc_list_merge(&survivors, visited);
16271628
assert(gc_list_is_empty(&increment));
1628-
gcstate->work_to_do += gcstate->heap_size / SCAN_RATE_DIVISOR / scale_factor;
16291629
gcstate->work_to_do -= increment_size;
16301630

16311631
add_stats(gcstate, 1, stats);

0 commit comments

Comments
 (0)