
On Wed, Dec 15, 2021 at 2:57 PM Guido van Rossum <guido@python.org> wrote:
I don't know how long that would take, but I suspect that a program that just increments the refcount relentlessly would have to run for hours before hitting this range. On a 64-bit machine the same approach would require years to run before a refcount would exceed the maximum allowable imbalance. (These estimates are from Mark Shannon.)
Hm, not quite. I modified a fast builtin to incref its argument, and then I called it in a `while True` loop, interrupted, and timed it. This did ~24,000,000 INCREFs/second. This would hit 0x_2000_0000 in about 9 minutes. And I wasn't even trying that hard -- I could have written the loop in C. (I did comment out an audit call though. :-) The same loop on 64-bit would take 1700 years to reach the limit, so we're safe there. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-c...>