diff options
author | Petr Viktorin <encukou@gmail.com> | 2024-12-10 10:53:56 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-10 10:53:56 (GMT) |
commit | 690fe077f6b1bf50e9d62078b22c334775efb3af (patch) | |
tree | e8b14b535be8045fa638950df31e3a2a629e6b32 /Lib/test | |
parent | ae31df354d02e12bf656954c5c72380d96c1dc0e (diff) | |
download | cpython-690fe077f6b1bf50e9d62078b22c334775efb3af.zip cpython-690fe077f6b1bf50e9d62078b22c334775efb3af.tar.gz cpython-690fe077f6b1bf50e9d62078b22c334775efb3af.tar.bz2 |
gh-126491: Revert "GH-126491: Lower heap size limit with faster marking (GH-127519)" (GH-127770)
Revert "GH-126491: Lower heap size limit with faster marking (GH-127519)"
This reverts commit 023b7d2141467017abc27de864f3f44677768cb3, which introduced
a refleak.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_gc.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/Lib/test/test_gc.py b/Lib/test/test_gc.py index baf8e95..b514005 100644 --- a/Lib/test/test_gc.py +++ b/Lib/test/test_gc.py @@ -1161,19 +1161,27 @@ class IncrementalGCTests(unittest.TestCase): return head head = make_ll(1000) + count = 1000 + + # There will be some objects we aren't counting, + # e.g. the gc stats dicts. This test checks + # that the counts don't grow, so we try to + # correct for the uncounted objects + # This is just an estimate. + CORRECTION = 20 enabled = gc.isenabled() gc.enable() olds = [] initial_heap_size = _testinternalcapi.get_tracked_heap_size() - iterations = max(20_000, initial_heap_size) - for i in range(iterations): + for i in range(20_000): newhead = make_ll(20) + count += 20 newhead.surprise = head olds.append(newhead) if len(olds) == 20: new_objects = _testinternalcapi.get_tracked_heap_size() - initial_heap_size - self.assertLess(new_objects, initial_heap_size/2, f"Heap growing. Reached limit after {i} iterations") + self.assertLess(new_objects, 27_000, f"Heap growing. Reached limit after {i} iterations") del olds[:] if not enabled: gc.disable() |