Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

GH-126491: GC: Mark objects reachable from roots before doing cycle collection #127110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Dec 2, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refactor work to do calculation
  • Loading branch information
markshannon committed Nov 21, 2024
commit be636c95476b1475671175129f668e9f569de0db
11 changes: 6 additions & 5 deletions 11 Python/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1548,14 +1548,15 @@ assess_work_to_do(GCState *gcstate)
* This could be improved by tracking survival rates, but it is still a
* large improvement on the non-marking approach.
*/
Py_ssize_t scale_factor = gcstate->old[0].threshold;
intptr_t scale_factor = gcstate->old[0].threshold;
if (scale_factor < 2) {
scale_factor = 2;
}
Py_ssize_t new_objects = gcstate->young.count;
Py_ssize_t heap_fraction = gcstate->heap_size / SCAN_RATE_DIVISOR / scale_factor;
if (heap_fraction > new_objects*2) {
heap_fraction = new_objects*2;
intptr_t new_objects = gcstate->young.count;
intptr_t max_heap_fraction = new_objects * 3/2;
intptr_t heap_fraction = gcstate->heap_size / SCAN_RATE_DIVISOR / scale_factor;
if (heap_fraction > max_heap_fraction) {
heap_fraction = max_heap_fraction;
}
gcstate->young.count = 0;
return new_objects + heap_fraction;
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.