FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

GH-141890: Fix GC double-counting of marked objects by brandtbucher · Pull Request #141891 · python/cpython · GitHub

Repository navigation

GH-141890: Fix GC double-counting of marked objects - #141891

Closed
brandtbucher wants to merge 2 commits into
python:mainfrom
brandtbucher:gc-double-count
Closed

brandtbucher wants to merge 2 commits into
python:mainfrom
brandtbucher:gc-double-count

Conversation

brandtbucher commented Nov 24, 2025 •
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Member

This move happens twice: once here, and once in gc_collect_increment (the caller).

Copy link
Copy Markdown
Contributor

JFYI, #127519

With marking added to the cyclic GC (#127110) we spend a lot of the time in the GC forming transitive closures, both for marking and for the increments of the incremental GC.

Unfortunately the current algorithm has a couple of mistakes in it. One harmful, one beneficial.

The beneficial one is counting the initial mark twice. This helps because it reduces the cost of GC on heaps with little or no garbage
The harmful one is allowing the amount of work done to grow in proportion to the heap size.

Unfortunately, #127519 was reverted.

I had planned to try to fix it, but it's still on my to-do list.

Copy link
Copy Markdown
Member Author

Ah, interesting. Let's benchmark this change. If the current version is better, we can just multiply by two to be explicit instead of the current code (which looks like a mistake, because originally it was). :)

github-actions Bot commented May 2, 2026

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

github-actions Bot added the stale Stale PR or inactive for long period of time. label May 2, 2026

Copy link
Copy Markdown
Contributor

The generational GC has landed, so this can be closed. Would you like me to close this?

github-actions Bot removed the stale Stale PR or inactive for long period of time. label May 16, 2026
serhiy-storchaka added the needs backport to 3.15 bugs and security fixes label May 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL