Skip to content

Commit b20c49f

Browse files
committed
gh-152190: Fix memory checking failure in test_strip_removed_large_file_with_dd_no_sig
Remove the overly restrictive `allowed_memory` override (200 KiB) in `test_strip_removed_large_file_with_dd_no_sig` to prevent a memory checking failure. Additionally, redefine the global baseline allowed memory as a 10x multiplier of the platform's default buffer size (`io.DEFAULT_BUFFER_SIZE`) instead of a static 10 MiB constant. This ensures the threshold scales safely relative to the underlying stream environment topography.
1 parent aec0aed commit b20c49f

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

Lib/test/test_zipfile64.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import time
1616
import tracemalloc
1717
import sys
18+
import io
1819
import unittest.mock as mock
1920

2021
from tempfile import TemporaryFile
@@ -100,8 +101,9 @@ def setUp(self):
100101
# It will contain enough copies of self.data to reach about 8 GiB.
101102
self.datacount = 8*1024**3 // len(self.data)
102103

103-
# memory usage should not exceed 10 MiB
104-
self.allowed_memory = 10*1024**2
104+
# Memory usage should not exceed the platform's default buffer size too
105+
# much (10x as threshold)
106+
self.allowed_memory = io.DEFAULT_BUFFER_SIZE * 10
105107

106108
def _write_large_file(self, fh):
107109
next_time = time.monotonic() + _PRINT_WORKING_MSG_INTERVAL
@@ -201,7 +203,6 @@ def test_strip_removed_large_file_with_dd_no_sig(self):
201203
large file without causing a memory issue."""
202204
# Reduce data scale for this test, as it's especially slow...
203205
self.datacount = 30*1024**2 // len(self.data)
204-
self.allowed_memory = 200*1024
205206

206207
# Try the temp file. If we do TESTFN2, then it hogs
207208
# gigabytes of disk space for the duration of the test.

0 commit comments

Comments
 (0)