Skip to content

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

Merged
hugovk merged 2 commits into
python:3.14from
sergey-miryanov:feat/gc-gen-3.14+heap_size
Apr 29, 2026
Merged

hugovk merged 2 commits into
python:3.14from
sergey-miryanov:feat/gc-gen-3.14+heap_size

Conversation

@sergey-miryanov

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

Copy link
Copy Markdown
Contributor
@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

hugovk commented Apr 28, 2026

Copy link
Copy Markdown
Member

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

@hugovk
hugovk merged commit 4d0ae4c into python:3.14 Apr 29, 2026
47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

4 participants