GH-140638: Add a GC "duration" stat#141720
Merged
brandtbucher merged 5 commits intopython:mainfrom Nov 19, 2025
Merged
Conversation
pablogsal
reviewed
Nov 18, 2025
| * ``uncollectable`` is the total number of objects which were found | ||
| to be uncollectable (and were therefore moved to the :data:`garbage` | ||
| list) inside this generation. | ||
| list) inside this generation; |
Member
There was a problem hiding this comment.
Suggested change
| list) inside this generation; | |
| list) inside this generation. |
Member
Author
There was a problem hiding this comment.
I just did this for consistency with the above points, haha.
pablogsal
reviewed
Nov 18, 2025
Python/gc_free_threading.c
Outdated
| @@ -1928,7 +1928,8 @@ invoke_gc_callback(PyThreadState *tstate, const char *phase, | |||
| info = Py_BuildValue("{sisnsn}", | |||
Member
There was a problem hiding this comment.
You need to change this line to
Suggested change
| info = Py_BuildValue("{sisnsn}", | |
| info = Py_BuildValue("{sisnsnsd}", |
no?
Member
Author
There was a problem hiding this comment.
Nice catch, thanks. Annoying that it just ignores trailing args like that.
pablogsal
approved these changes
Nov 18, 2025
This comment was marked as spam.
This comment was marked as spam.
StanFromIreland
pushed a commit
to StanFromIreland/cpython
that referenced
this pull request
Dec 6, 2025
ashm-dev
pushed a commit
to ashm-dev/cpython
that referenced
this pull request
Dec 8, 2025
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a useful
"duration"stat togc.get_statsandgc.callbacks. It also fixes an issue where the existing timer could be used uninitialized if the GC's debug flags are set during a collection.durationandvisitedto thegc.callbacksandgc.get_stats()dicts #140638📚 Documentation preview 📚: https://cpython-previews--141720.org.readthedocs.build/