Skip to content

gh-75876: Run bigmem tests in a subprocess - #155302

Merged
serhiy-storchaka merged 4 commits into
python:mainfrom
serhiy-storchaka:bigmemtest-isolate
Aug 18, 2026
Merged

gh-75876: Run bigmem tests in a subprocess#155302
serhiy-storchaka merged 4 commits into
python:mainfrom
serhiy-storchaka:bigmemtest-isolate

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Aug 6, 2026

Copy link
Copy Markdown
Member

A test which really allocates the memory it asks for (that is, run with -M) now runs in a subprocess, so that the memory it uses and the address space it fragments are released when it ends. A dummy run stays in the process.

The parent process watches the memory usage of the subprocess while waiting for it, so Lib/test/memory_watchdog.py and the separate watchdog process are no longer needed. _SubprocessTest.wait() calls back every second between communicate() timeouts, which does not lose the subprocess output.

Tested with -M 4G and -M 20G on Linux, and with -M 4G on FreeBSD and on a Windows debug build.

A test which really allocates the memory it asks for (that is, run with -M)
now runs in a subprocess, so that the memory it uses and the address space
it fragments are released when it ends.  A dummy run stays in the process.

The parent process watches the memory usage of the subprocess while waiting
for it, so the separate watchdog process is no longer needed.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
@bedevere-app bedevere-app Bot mentioned this pull request Aug 6, 2026
@serhiy-storchaka serhiy-storchaka added skip news tests Tests in the Lib/test dir labels Aug 6, 2026
@serhiy-storchaka serhiy-storchaka added 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 6, 2026
@serhiy-storchaka
serhiy-storchaka enabled auto-merge (squash) August 18, 2026 07:08
@serhiy-storchaka
serhiy-storchaka merged commit 66d7c89 into python:main Aug 18, 2026
51 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.15 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 66d7c891044915ccb7a12e0cc2c78991508e816e 3.15

@miss-islington-app

Copy link
Copy Markdown

Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.14 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 66d7c891044915ccb7a12e0cc2c78991508e816e 3.14

@miss-islington-app

Copy link
Copy Markdown

Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 66d7c891044915ccb7a12e0cc2c78991508e816e 3.13

@bedevere-app

bedevere-app Bot commented Aug 18, 2026

Copy link
Copy Markdown

GH-156013 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Aug 18, 2026
@bedevere-app

bedevere-app Bot commented Aug 18, 2026

Copy link
Copy Markdown

GH-156014 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs backport to 3.15 pre-release feature fixes, bugs and security fixes tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant