reduce gc_collect_harder default to 1 on CPython#14441
reduce gc_collect_harder default to 1 on CPython#14441miketheman wants to merge 2 commits intopytest-dev:mainfrom
Conversation
The 5-iteration default was borrowed from the Trio project, where it was determined empirically to handle PyPy's object resurrection behavior: on PyPy, objects like coroutines can survive GC rounds because executing their __del__ can resurrect them. On CPython, reference counting frees most objects immediately. One GC pass is sufficient to handle reference cycles, as confirmed by all test_unraisableexception tests passing (including the refcycle variants). Use 1 pass on CPython and retain 5 on PyPy. Signed-off-by: Mike Fiedler <miketheman@gmail.com>
|
Draft, since I'm not certain this is a good idea. |
|
Im nit familiar with the plugin myself |
|
Unknown - I'm looking at history, and there's already once case that resets it to 0 no matter what - #13482 |
|
I was uneasy with the multiple gc rounds but I couldn't entirely demonstrate the slowdown. But for me your report is sufficient. The unraisableexception plugin is non-deterministic and doing multiple gc rounds trying to make it so just seems too heavy. So basically +1 from me. I would also not add a special case for PyPI. |
|
See also 391324e. Also cc @graingert. |
|
Thanks for the CC, I have no opinion on this though |
The 5-iteration default was borrowed from the Trio project, where it was determined empirically to handle PyPy's object resurrection behavior: on PyPy, objects like coroutines can survive GC rounds because executing their del can resurrect them.
On CPython, reference counting frees most objects immediately. One GC pass is sufficient to handle reference cycles, as confirmed by all test_unraisableexception tests passing (including the refcycle variants).
Use 1 pass on CPython and retain 5 on PyPy.