Skip to content

gh-152190: Fix memory checking failure in test_strip_removed_large_file_with_dd_no_sig#152203

Open
danny0838 wants to merge 3 commits into
python:mainfrom
danny0838:gh-51067-6
Open

gh-152190: Fix memory checking failure in test_strip_removed_large_file_with_dd_no_sig#152203
danny0838 wants to merge 3 commits into
python:mainfrom
danny0838:gh-51067-6

Conversation

@danny0838

@danny0838 danny0838 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

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 multiplier of the default buffer size instead of a static 10 MiB constant. This ensures the threshold scales safely relative to the underlying platform.

@bedevere-app bedevere-app Bot added the tests Tests in the Lib/test dir label Jun 25, 2026
@StanFromIreland StanFromIreland changed the title gh-51067: Fix memory checking failure in test_strip_removed_large_file_with_dd_no_sig gh-152190: Fix memory checking failure in test_strip_removed_large_file_with_dd_no_sig Jun 25, 2026
@danny0838 danny0838 force-pushed the gh-51067-6 branch 3 times, most recently from c98f30e to 34a009b Compare June 25, 2026 14:52
@danny0838 danny0838 marked this pull request as draft June 25, 2026 17:38
…arge_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.
Introduce the `assert_memory_usage` context manager to narrow the scope
of tracemalloc tracking down exclusively to the file-repacking phase.

This prevents previous file-writing side effects from interfering with
the baseline, improves tracing accuracy, and eliminates redundant inner
sub-function wrappers.
@danny0838

Copy link
Copy Markdown
Contributor Author

It seems that a dynamic memory threshold cannot be easily calculated. Keep the original empirical threshold and revise the comment to be more clear.

Additionally, introduce the assert_memory_usage context manager and refactor the test code to improve memory checking accuracy as well as remove redundant inner sub-function wrappers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants