diff options
author | Mark Shannon <mark@hotpy.org> | 2024-12-06 10:46:59 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-06 10:46:59 (GMT) |
commit | 023b7d2141467017abc27de864f3f44677768cb3 (patch) | |
tree | fc99a157d5b4dffa4c15a3aa7b47125073d5348b /Lib | |
parent | 8b7c194c7bf7e547e4f6317528f0dcb9344c18c7 (diff) | |
download | cpython-023b7d2141467017abc27de864f3f44677768cb3.zip cpython-023b7d2141467017abc27de864f3f44677768cb3.tar.gz cpython-023b7d2141467017abc27de864f3f44677768cb3.tar.bz2 |
GH-126491: Lower heap size limit with faster marking (GH-127519)
* Faster marking of reachable objects
* Changes calculation of work to do and work done.
* Merges transitive closure calculations
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_gc.py | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/Lib/test/test_gc.py b/Lib/test/test_gc.py index b514005..baf8e95 100644 --- a/Lib/test/test_gc.py +++ b/Lib/test/test_gc.py @@ -1161,27 +1161,19 @@ 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() - for i in range(20_000): + iterations = max(20_000, initial_heap_size) + for i in range(iterations): 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, 27_000, f"Heap growing. Reached limit after {i} iterations") + self.assertLess(new_objects, initial_heap_size/2, f"Heap growing. Reached limit after {i} iterations") del olds[:] if not enabled: gc.disable() |