Skip to content

C-API docs: Clarify the size of arenas #110895

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 16, 2023

Conversation

mienxiu
Copy link
Contributor

@mienxiu mienxiu commented Oct 15, 2023

From 3.10.0 alpha 7, the pymalloc allocator uses arenas with a fixed size of 1
MiB on 64-bit platforms instead of 256 KiB on 32-bit platforms.

This is changed in #14474 (bpo-37448).
The following links are the relevant lines in the C code for your reference.


📚 Documentation preview 📚: https://cpython-previews--110895.org.readthedocs.build/

From 3.10.0 alpha 7, the pymalloc allocator uses arenas with a fixed size of 1
MiB on 64-bit platforms instead of 256 KiB on 32-bit platforms.
@ghost
Copy link

ghost commented Oct 15, 2023

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-app bedevere-app bot added awaiting review docs Documentation in the Doc dir skip news labels Oct 15, 2023
@mienxiu
Copy link
Contributor Author

mienxiu commented Oct 15, 2023

I skipped creating an issue, but I'm willing to create one if it's more appropriate for this request.

@AlexWaygood AlexWaygood changed the title Clarify the size of arenas C-API docs: Clarify the size of arenas Oct 15, 2023
@vstinner
Copy link
Member

vstinner commented Oct 16, 2023

cc @nascheme

Ah right, the arena size was changed by commit 85b6b70 (PR GH-14474, issue gh-81629):

-#define ARENA_SIZE              (256 << 10)     /* 256KB */
+#ifdef USE_LARGE_ARENAS
+#define ARENA_BITS              20                    /* 1 MiB */
+#else
+#define ARENA_BITS              18                    /* 256 KiB */
+#endif

with:

#if SIZEOF_VOID_P > 4
/* on 64-bit platforms use larger pools and arenas if we can */
#define USE_LARGE_ARENAS
...
#endif

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but I would prefer that another core dev double check.

cc @hugovk @corona10

@nascheme
Copy link
Member

The docs update is correct.

@AlexWaygood AlexWaygood merged commit f07ca27 into python:main Oct 16, 2023
@AlexWaygood AlexWaygood added needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes labels Oct 16, 2023
@miss-islington-app
Copy link

Thanks @mienxiu for the PR, and @AlexWaygood for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@miss-islington-app
Copy link

Thanks @mienxiu for the PR, and @AlexWaygood for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 16, 2023
Clarify the size of arenas

From 3.10.0 alpha 7, the pymalloc allocator uses arenas with a fixed size of 1
MiB on 64-bit platforms instead of 256 KiB on 32-bit platforms.
(cherry picked from commit f07ca27)

Co-authored-by: Mienxiu <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Oct 16, 2023

GH-110946 is a backport of this pull request to the 3.12 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 16, 2023
Clarify the size of arenas

From 3.10.0 alpha 7, the pymalloc allocator uses arenas with a fixed size of 1
MiB on 64-bit platforms instead of 256 KiB on 32-bit platforms.
(cherry picked from commit f07ca27)

Co-authored-by: Mienxiu <[email protected]>
@bedevere-app bedevere-app bot removed the needs backport to 3.12 only security fixes label Oct 16, 2023
@bedevere-app
Copy link

bedevere-app bot commented Oct 16, 2023

GH-110947 is a backport of this pull request to the 3.11 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.11 only security fixes label Oct 16, 2023
AlexWaygood pushed a commit that referenced this pull request Oct 16, 2023
C-API docs: Clarify the size of arenas (GH-110895)

Clarify the size of arenas

From 3.10.0 alpha 7, the pymalloc allocator uses arenas with a fixed size of 1
MiB on 64-bit platforms instead of 256 KiB on 32-bit platforms.
(cherry picked from commit f07ca27)

Co-authored-by: Mienxiu <[email protected]>
AlexWaygood pushed a commit that referenced this pull request Oct 16, 2023
C-API docs: Clarify the size of arenas (GH-110895)

Clarify the size of arenas

From 3.10.0 alpha 7, the pymalloc allocator uses arenas with a fixed size of 1
MiB on 64-bit platforms instead of 256 KiB on 32-bit platforms.
(cherry picked from commit f07ca27)

Co-authored-by: Mienxiu <[email protected]>
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
Clarify the size of arenas

From 3.10.0 alpha 7, the pymalloc allocator uses arenas with a fixed size of 1
MiB on 64-bit platforms instead of 256 KiB on 32-bit platforms.
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
Clarify the size of arenas

From 3.10.0 alpha 7, the pymalloc allocator uses arenas with a fixed size of 1
MiB on 64-bit platforms instead of 256 KiB on 32-bit platforms.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants