Skip to content

gh-75876: Correct the memory use declared by some bigmem tests - #155307

Open
serhiy-storchaka wants to merge 1 commit into
python:mainfrom
serhiy-storchaka:bigmemtest-memuse
Open

gh-75876: Correct the memory use declared by some bigmem tests#155307
serhiy-storchaka wants to merge 1 commit into
python:mainfrom
serhiy-storchaka:bigmemtest-memuse

Conversation

@serhiy-storchaka

Copy link
Copy Markdown
Member

Some bigmem tests declare less memory than they use. Measured as the peak RSS of a process running a single test with -M:

test declared measured
TupleTest.test_repeat_large_2 12.0 GiB 24.2 GiB 2.02x
HashLibTestCase.test_case_md5_huge 4.0 GiB 8.3 GiB 2.06x
HashLibTestCase.test_case_md5_uintmax 4.0 GiB 8.3 GiB 2.06x
ZlibDecompressorTest.testDecompress4G 13.2 GiB 16.3 GiB 1.23x
BigmemTclTest.test_huge_string_builtins 4.0 GiB 6.0 GiB 1.51x
ReTests.test_large_subn 36.0 GiB 37.7 GiB 1.05x

test_repeat_large_2 keeps 3 tuples of pointers alive, as test_repeat_small and test_repeat_large do, but declared 12 instead of pointer_size * 3, which is the count for a 32-bit build.

The md5 tests pass the data to check_file_digest(), which copies all of it into an io.BytesIO().

testDecompress4G keeps the data, the compressed and the decompressed bytes alive at the same time, and the decompressor grows its output buffer.

These are the only tests which use more memory than they declare. The other 227 bigmem tests were measured too: the largest excess is 1.03x, and it is 20 MiB in the median.

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>
@bedevere-app bedevere-app Bot added the tests Tests in the Lib/test dir label Aug 7, 2026
@bedevere-app bedevere-app Bot mentioned this pull request Aug 7, 2026
@serhiy-storchaka serhiy-storchaka added skip news needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core review needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant