-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a function to get GC statistics #60555
Comments
This patch adds a function named gc.get_stats() which returns a list of dictionaries containing per-generation statistics: >>> import pprint, gc
>>> pprint.pprint(gc.get_stats())
[{'collected': 0, 'collections': 12, 'uncollectable': 0},
{'collected': 0, 'collections': 1, 'uncollectable': 0},
{'collected': 0, 'collections': 0, 'uncollectable': 0}] |
What are the possible performance implications of the statistics? |
You mean negative implications? None :-) |
Why dictionaries and not struct sequences? |
Oh, I understand. GC callbacks receive a dict. For avoid confusion with gc.DEBUG_STATS and to conform with callbacks argument name, may be better to name this function as gc.get_infos([generation])? |
I.e. gc.get_info([generation]). Returns the info for specified generation or total if the parameter omitted. |
Because it's much simpler like that.
Well, this is really about statistics, not general information. |
New changeset 43d87cdf9457 by Antoine Pitrou in branch 'default': |
Now committed. |
Well, I wrote a patch with structure sequences, it is really much more expansive. I have some comments.
|
New changeset 17bd04fbf3d3 by R David Murray in branch 'default': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: