Skip to content

[3.14] GH-148726: Add heap_size to _gc_runtime_state#149025

Open
sergey-miryanov wants to merge 2 commits intopython:3.14from
sergey-miryanov:feat/gc-gen-3.14+heap_size
Open

[3.14] GH-148726: Add heap_size to _gc_runtime_state#149025
sergey-miryanov wants to merge 2 commits intopython:3.14from
sergey-miryanov:feat/gc-gen-3.14+heap_size

Conversation

@sergey-miryanov
Copy link
Copy Markdown
Contributor

@sergey-miryanov sergey-miryanov commented Apr 26, 2026

@nascheme
Copy link
Copy Markdown
Member

LGTM. However, given there are no public APIs to use this heap_size value, I'm wondering if this is worth the small cost to track it. Since it was in the 3.14.0, maybe its best to restore it. Does someone have a concrete use case for it? Maybe your enhanced GC stats?

@sergey-miryanov
Copy link
Copy Markdown
Contributor Author

Yeah, we unfortunately don't have a public API for heap_size. Even my gc-stats module is only available for 3.15, because many _Py_DebugOffsets changes weren't backported.

But tools like py-spy can "reconstruct" the _gc_runtime_state layout for a specific Python version and get access to this field.

But,... now might be a good time to add 'heap_size' to the callback? :) @hugovk

@hugovk
Copy link
Copy Markdown
Member

hugovk commented Apr 28, 2026

This PR looks okay as-is, can you update the ABI file and then summon the buildbots?

@sergey-miryanov sergey-miryanov added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Apr 28, 2026
@bedevere-bot
Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @sergey-miryanov for commit 9a67a99 🤖

Results will be shown at:

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

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

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Apr 28, 2026
@sergey-miryanov
Copy link
Copy Markdown
Contributor Author

Buildbots failures are unrelated - the same as in previous PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants