Skip to content

gh-75876: Limit the address space of a bigmem test - #156023

Open
serhiy-storchaka wants to merge 2 commits into
python:mainfrom
serhiy-storchaka:bigmemtest-rlimit
Open

gh-75876: Limit the address space of a bigmem test#156023
serhiy-storchaka wants to merge 2 commits into
python:mainfrom
serhiy-storchaka:bigmemtest-rlimit

Conversation

@serhiy-storchaka

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

Copy link
Copy Markdown
Member

A test run with -M now runs with the address space limited to what it declares plus 512 MiB, so that a test which uses much more memory than it declares fails with a MemoryError instead of making the machine swap.

The margin does not grow with the declared size: the interpreter itself reserves about 250 MiB, whatever the test asks for.

limit_address_space=False exempts a test which reserves much more address space than it uses. The two threaded tests in test_interpreters need it: glibc reserves an arena per thread, up to 8 per CPU, and this alone exceeds the declared size on a machine with many cores.

A test run with -M now runs in a subprocess whose address space is limited
to what it declares plus 512 MiB.  A test which uses much more memory than
it declares fails with a MemoryError instead of making the machine swap.

Pass limit_address_space=False for a test which reserves much more address
space than it uses.  The two threaded tests in test_interpreters do: glibc
reserves an arena per thread, up to 8 per CPU, and this alone exceeds the
declared size on a machine with many cores.
@bedevere-app bedevere-app Bot mentioned this pull request Aug 18, 2026
@serhiy-storchaka serhiy-storchaka added the tests Tests in the Lib/test dir label Aug 18, 2026
@read-the-docs-community

read-the-docs-community Bot commented Aug 18, 2026

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #34125543 | 📁 Comparing 8bc2c01 against main (c612fd4)

  🔍 Preview build  

2 files changed
± library/test.html
± whatsnew/changelog.html

AddressSanitizer reserves terabytes of address space for its shadow memory,
so any limit stops the interpreter from starting.

macOS reserves much more address space than Linux does, so 512 MiB is not
enough of a margin there.
@serhiy-storchaka

Copy link
Copy Markdown
Member Author

!buildbot bigmem

@bedevere-bot

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @serhiy-storchaka for commit 8bc2c01 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F156023%2Fmerge

The command will test the builders whose names match following regular expression: bigmem

The builders matched are:

  • aarch64 Ubuntu 24.04 BigMem PR

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

Labels

awaiting core review tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants