https://github.com/python/cpython/commit/e469fa9c8077345c75da6e39d40534e7a6fc5057
commit: e469fa9c8077345c75da6e39d40534e7a6fc5057
branch: main
author: Serhiy Storchaka <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2026-08-07T09:32:04+03:00
summary:

gh-75876: Correct the memory use declared by some bigmem tests (GH-155307)

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) <[email protected]>

files:
M Lib/test/test_bigmem.py
M Lib/test/test_hashlib.py
M Lib/test/test_re.py
M Lib/test/test_tcl.py
M Lib/test/test_zlib.py

diff --git a/Lib/test/test_bigmem.py b/Lib/test/test_bigmem.py
index 7f53379a952dfc..3c09cdb8640890 100644
--- a/Lib/test/test_bigmem.py
+++ b/Lib/test/test_bigmem.py
@@ -901,7 +901,7 @@ def test_repeat_small(self, size):
     def test_repeat_large(self, size):
         return self.basic_test_repeat(size)
 
-    @bigmemtest(size=_1G - 1, memuse=12)
+    @bigmemtest(size=_1G - 1, memuse=pointer_size * 3)
     def test_repeat_large_2(self, size):
         return self.basic_test_repeat(size)
 
diff --git a/Lib/test/test_hashlib.py b/Lib/test/test_hashlib.py
index f0e2d527af2615..253a8f455853f5 100644
--- a/Lib/test/test_hashlib.py
+++ b/Lib/test/test_hashlib.py
@@ -691,12 +691,12 @@ def test_case_md5_2(self):
         )
 
     @unittest.skipIf(sys.maxsize < _4G + 5, 'test cannot run on 32-bit 
systems')
-    @bigmemtest(size=_4G + 5, memuse=1, dry_run=False)
+    @bigmemtest(size=_4G + 5, memuse=2, dry_run=False)
     def test_case_md5_huge(self, size):
         self.check('md5', b'A'*size, 'c9af2dff37468ce5dfee8f2cfc0a9c6d')
 
     @unittest.skipIf(sys.maxsize < _4G - 1, 'test cannot run on 32-bit 
systems')
-    @bigmemtest(size=_4G - 1, memuse=1, dry_run=False)
+    @bigmemtest(size=_4G - 1, memuse=2, dry_run=False)
     def test_case_md5_uintmax(self, size):
         self.check('md5', b'A'*size, '28138d306ff1b8281f1a9067e1a1a2b3')
 
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py
index af6e4612dcfaef..d086fd521e73b5 100644
--- a/Lib/test/test_re.py
+++ b/Lib/test/test_re.py
@@ -2251,7 +2251,7 @@ def test_large_search(self, size):
 
     # The huge memuse is because of re.sub() using a list and a join()
     # to create the replacement result.
-    @bigmemtest(size=_2G, memuse=16 + 2)
+    @bigmemtest(size=_2G, memuse=16 + 3)
     def test_large_subn(self, size):
         # Issue #10182: indices were 32-bit-truncated.
         s = 'a' * size
diff --git a/Lib/test/test_tcl.py b/Lib/test/test_tcl.py
index 26be4ee0d7afe4..b0458e46c6bece 100644
--- a/Lib/test/test_tcl.py
+++ b/Lib/test/test_tcl.py
@@ -805,7 +805,7 @@ def test_huge_string_call(self, size):
 
     @support.cpython_only
     @unittest.skipUnless(INT_MAX < PY_SSIZE_T_MAX, "needs UINT_MAX < SIZE_MAX")
-    @support.bigmemtest(size=INT_MAX + 1, memuse=2, dry_run=False)
+    @support.bigmemtest(size=INT_MAX + 1, memuse=3, dry_run=False)
     def test_huge_string_builtins(self, size):
         tk = self.interp.tk
         value = '1' + ' ' * size
diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py
index ed9d85408159b2..46c84c55c93398 100644
--- a/Lib/test/test_zlib.py
+++ b/Lib/test/test_zlib.py
@@ -1090,7 +1090,7 @@ def testEOFError(self):
         self.assertRaises(EOFError, zlibd.decompress, b"")
 
     @support.skip_if_pgo_task
-    @bigmemtest(size=_4G + 100, memuse=3.3)
+    @bigmemtest(size=_4G + 100, memuse=4.5)
     def testDecompress4G(self, size):
         # "Test zlib._ZlibDecompressor.decompress() with >4GiB input"
         blocksize = min(10 * 1024 * 1024, size)

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to