Skip to content

GH-148726: Add heap_size to generational GC - #149195

Merged
pablogsal merged 11 commits into
python:mainfrom
sergey-miryanov:feat/gc-gen-3.15+heap_size
May 4, 2026
Merged

GH-148726: Add heap_size to generational GC#149195
pablogsal merged 11 commits into
python:mainfrom
sergey-miryanov:feat/gc-gen-3.15+heap_size

Conversation

@sergey-miryanov

@sergey-miryanovsergey-miryanov commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

@sergey-miryanovsergey-miryanov changed the title Add heap_size to generational GCGH-148726: Add heap_size to generational GCApr 30, 2026
@nascheme

Copy link
Copy Markdown
Member

LGTM.

@hugovkhugovk added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label May 1, 2026
@bedevere-bot

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @hugovk for commit 2281499 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F149195%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

@bedevere-botbedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label May 1, 2026
@sergey-miryanov

Copy link
Copy Markdown
ContributorAuthor

Good catch by @DinoV in #149241. I believe we should cherry-pick those commits here.

@hugovk

Copy link
Copy Markdown
Member

Good catch by @DinoV in #149241. I believe we should cherry-pick those commits here.

Good idea.

@sergey-miryanov

Copy link
Copy Markdown
ContributorAuthor

@zanieb@nascheme Could you please take another look? I've ported the 3.14 heap_size changes and included heap_size in get_gc_stats.

@DinoV FYI, the layout of _gc_runtime_state will change since we moved generation_stats to the heap.

@nascheme

Copy link
Copy Markdown
Member

I'd say for 3.15 we don't need the two dummy members and we could move generation0 back to it's old position. Preserving the member offsets should not be required for 3.15, right?

@sergey-miryanov

Copy link
Copy Markdown
ContributorAuthor

Since we're moving the stats to the heap, all subsequent offsets will shift anyway. There's no need to keep the dummy members.

I thought this would simplify backports if needed.

I'm happy to remove the dummy members and restore generation0 if you think that's cleaner.

@nascheme

Copy link
Copy Markdown
Member

I'm happy to remove the dummy members and restore generation0 if you think that's cleaner.

I think it's better to remove the dummy members. You don't have to restore generation0 since the code looks fine without that member. Other than that, this PR looks fine to me.

@sergey-miryanov

Copy link
Copy Markdown
ContributorAuthor

@nascheme Thanks! Done.

@pablogsalpablogsal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pablogsal
pablogsal merged commit e89568f into python:mainMay 4, 2026
69 checks passed
@sergey-miryanov

Copy link
Copy Markdown
ContributorAuthor

Thanks all!

Sign up for freeto 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.

6 participants

@sergey-miryanov@nascheme@bedevere-bot@hugovk@zanieb@pablogsal