◐ Shell
clean mode source ↗

[3.14] GH-148726: Add heap_size to _gc_runtime_state by sergey-miryanov · Pull Request #149025 · python/cpython

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