Skip to content

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

Merged
AlexWaygood merged 1 commit into
python:mainfrom
mienxiu:clarify-arenas-size
Oct 16, 2023
Merged

C-API docs: Clarify the size of arenas#110895
AlexWaygood merged 1 commit into
python:mainfrom
mienxiu:clarify-arenas-size

Conversation

@mienxiu

@mienxiu mienxiu commented Oct 15, 2023

Copy link
Copy Markdown
Contributor

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

ghost commented Oct 15, 2023

Copy link
Copy Markdown

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

mienxiu commented Oct 15, 2023

Copy link
Copy Markdown
Contributor Author

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

vstinner commented Oct 16, 2023

Copy link
Copy Markdown
Member

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

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown

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
Copy Markdown

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

bedevere-app Bot commented Oct 16, 2023

Copy link
Copy Markdown

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

bedevere-app Bot commented Oct 16, 2023

Copy link
Copy Markdown

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