Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Garbage collector generation threshold #1027

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

Closed
zikcheng opened this issue Jan 14, 2023 · 1 comment · Fixed by #1030
Closed

Garbage collector generation threshold #1027

zikcheng opened this issue Jan 14, 2023 · 1 comment · Fixed by #1030
Assignees
Labels

Comments

@zikcheng
Copy link
Contributor

In post https://github.com/python/devguide/blob/main/internals/garbage-collector.rst, generation threshold is described as follwing:

Generations are collected when the number of objects that they contain reaches some predefined threshold, which is unique for each generation and is lower the older the generations are.

It sounds like generation 0 starts when there are 700 objects in it, generation 1 starts when there are 10 objects in it and generation 2 starts when there are 10 objects in it.

This is very different from the fact(at least for generation 1) which https://docs.python.org/3/library/gc.html#gc.set_threshold describes:

If generation 0 has been examined more than threshold1 times since generation 1 has been examined, then generation 1 is examined as well. With the third generation, things are a bit more complicated, see Collecting the oldest generation for more information.

Maybe I am too literal, but I think it's really misleading.

@pablogsal
Copy link
Member

Thanks, @zikcheng for opening the issue!

Indeed, the current way this is described is confusing and incorrect. I will update the text so it matches the documentation.

Thanks for noticing the error!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants