mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
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 023b7d2141
, which introduced
a refleak.
This commit is contained in:
parent
ae31df354d
commit
690fe077f6
6 changed files with 248 additions and 214 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue