Skip to content

Commit aabe655

Browse files
gh-75876: Correct the memory use declared by some bigmem tests
Measured with a limited address space and the peak RSS of the process: * TupleTest.test_repeat_large_2 keeps 3 tuples of pointers alive, as its siblings do, but declared the count for a 32-bit build. * The md5 tests hash the data and a io.BytesIO() copy of it. * testDecompress4G keeps the data, the compressed and the decompressed bytes alive, and the decompressor grows its output buffer. * test_huge_string_builtins uses 3 times the string size, not 2. * test_large_subn uses a bit more than the 18 times it declared. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent cfcbfe4 commit aabe655

5 files changed

Lines changed: 6 additions & 6 deletions

File tree

Lib/test/test_bigmem.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,7 @@ def test_repeat_small(self, size):
901901
def test_repeat_large(self, size):
902902
return self.basic_test_repeat(size)
903903

904-
@bigmemtest(size=_1G - 1, memuse=12)
904+
@bigmemtest(size=_1G - 1, memuse=pointer_size * 3)
905905
def test_repeat_large_2(self, size):
906906
return self.basic_test_repeat(size)
907907

Lib/test/test_hashlib.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -691,12 +691,12 @@ def test_case_md5_2(self):
691691
)
692692

693693
@unittest.skipIf(sys.maxsize < _4G + 5, 'test cannot run on 32-bit systems')
694-
@bigmemtest(size=_4G + 5, memuse=1, dry_run=False)
694+
@bigmemtest(size=_4G + 5, memuse=2, dry_run=False)
695695
def test_case_md5_huge(self, size):
696696
self.check('md5', b'A'*size, 'c9af2dff37468ce5dfee8f2cfc0a9c6d')
697697

698698
@unittest.skipIf(sys.maxsize < _4G - 1, 'test cannot run on 32-bit systems')
699-
@bigmemtest(size=_4G - 1, memuse=1, dry_run=False)
699+
@bigmemtest(size=_4G - 1, memuse=2, dry_run=False)
700700
def test_case_md5_uintmax(self, size):
701701
self.check('md5', b'A'*size, '28138d306ff1b8281f1a9067e1a1a2b3')
702702

Lib/test/test_re.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2251,7 +2251,7 @@ def test_large_search(self, size):
22512251

22522252
# The huge memuse is because of re.sub() using a list and a join()
22532253
# to create the replacement result.
2254-
@bigmemtest(size=_2G, memuse=16 + 2)
2254+
@bigmemtest(size=_2G, memuse=16 + 3)
22552255
def test_large_subn(self, size):
22562256
# Issue #10182: indices were 32-bit-truncated.
22572257
s = 'a' * size

Lib/test/test_tcl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ def test_huge_string_call(self, size):
805805

806806
@support.cpython_only
807807
@unittest.skipUnless(INT_MAX < PY_SSIZE_T_MAX, "needs UINT_MAX < SIZE_MAX")
808-
@support.bigmemtest(size=INT_MAX + 1, memuse=2, dry_run=False)
808+
@support.bigmemtest(size=INT_MAX + 1, memuse=3, dry_run=False)
809809
def test_huge_string_builtins(self, size):
810810
tk = self.interp.tk
811811
value = '1' + ' ' * size

Lib/test/test_zlib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,7 @@ def testEOFError(self):
10901090
self.assertRaises(EOFError, zlibd.decompress, b"")
10911091

10921092
@support.skip_if_pgo_task
1093-
@bigmemtest(size=_4G + 100, memuse=3.3)
1093+
@bigmemtest(size=_4G + 100, memuse=4.5)
10941094
def testDecompress4G(self, size):
10951095
# "Test zlib._ZlibDecompressor.decompress() with >4GiB input"
10961096
blocksize = min(10 * 1024 * 1024, size)

0 commit comments

Comments
 (0)