GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-81057: Move the Allocators to _PyRuntimeState by ericsnowcurrently · Pull Request #99217 · python/cpython

Conversation

@ericsnowcurrently

@ericsnowcurrently ericsnowcurrently commented Nov 7, 2022

Copy link
Copy Markdown
Member

The global allocators were stored in 3 static global variables: _PyMem_Raw, _PyMem, and _PyObject. State for the "small block" allocator was stored in another 13. That makes a total of 16 global variables. We are moving all 16 to the _PyRuntimeState struct as part of the work for gh-81057. (If PEP 684 is accepted then we will follow up by moving them all to PyInterpreterState.)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ericsnowcurrently
ericsnowcurrently requested a review from a team as a code owner November 7, 2022 21:23
@bedevere-bot bedevere-bot added the awaiting core review label Nov 7, 2022
@ericsnowcurrently ericsnowcurrently self-assigned this Nov 7, 2022
@ericsnowcurrently ericsnowcurrently changed the title Move the Allocators to _PyRuntimeState gh-81057: Move the Allocators to _PyRuntimeState Nov 7, 2022
@bedevere-bot bedevere-bot mentioned this pull request Nov 7, 2022
[subinterpreters] Global C variables are a problem #81057
Closed
@ericsnowcurrently
ericsnowcurrently force-pushed the move-allocators-to-runtime-state branch from 124ad70 to 02256e9 Compare November 7, 2022 21:31
@ericsnowcurrently
ericsnowcurrently marked this pull request as draft November 7, 2022 21:33
@ericsnowcurrently
ericsnowcurrently force-pushed the move-allocators-to-runtime-state branch 2 times, most recently from 9ab2bfc to edcd287 Compare November 8, 2022 01:24
@ericsnowcurrently
ericsnowcurrently removed the request for review from a team November 8, 2022 01:29
ericsnowcurrently added 6 commits November 8, 2022 10:04
@ericsnowcurrently
Look up the current interpreter in PyObject_Malloc().
9a44e7a
@ericsnowcurrently
Move the low-level allocator implementations to a header file.
16cd128
@ericsnowcurrently
Move the top-level allocators state.
737877c
@ericsnowcurrently
Move the allocators to the runtime state.
6dd7ba5
@ericsnowcurrently
Drop debug code.
56251cb
@ericsnowcurrently
Move the top-level object allocator to the runtime state.
007eed4
@ericsnowcurrently
ericsnowcurrently force-pushed the move-allocators-to-runtime-state branch from edcd287 to aa8c9cb Compare November 8, 2022 18:58
ericsnowcurrently added 11 commits November 8, 2022 13:23
@ericsnowcurrently
Move the arenas state to the runtime state.
38a80d8
@ericsnowcurrently
Pass the context to initializers explicitly.
83d397f
@ericsnowcurrently
Move the allocator groupings to pycore_allocators.h.
991dfc8
@ericsnowcurrently
Move the arena allocator to pycore_pymem_init.h.
ac5cfb0
@ericsnowcurrently
Add a NEWS entry.
9f32218
@ericsnowcurrently
Move the object allocator definitions to pycore_obmalloc*.h.
e5fc139
@ericsnowcurrently
pycore_allocators.h -> pycore_pymem_allocators.h
d61b410
@ericsnowcurrently
Move the arena allocator impl to its own file.
0efcef7
@ericsnowcurrently
Move _Py_GetAllocatedBlocks() over.
ec01f99
@ericsnowcurrently
Move _PyObject_DebugMallocStat() over.
a1ff9b0
@ericsnowcurrently
Restore uint for obmalloc.
3172cbe
@ericsnowcurrently
ericsnowcurrently force-pushed the move-allocators-to-runtime-state branch from aa8c9cb to 3172cbe Compare November 8, 2022 20:46
@ericsnowcurrently
Do not define the functions in header files.
adc60e2
@ericsnowcurrently
Drop pycore_*_allocators.h.
5262207
@ericsnowcurrently ericsnowcurrently added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Nov 9, 2022
@bedevere-bot

bedevere-bot commented Nov 9, 2022

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @ericsnowcurrently for commit 5262207 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Nov 9, 2022
@ericsnowcurrently
ericsnowcurrently marked this pull request as ready for review November 10, 2022 17:33
@ericsnowcurrently
ericsnowcurrently merged commit 67807cf into python:main Nov 11, 2022
@bedevere-bot bedevere-bot removed the awaiting core review label Nov 11, 2022
@ericsnowcurrently
ericsnowcurrently deleted the move-allocators-to-runtime-state branch November 11, 2022 23:30
@jiridanek jiridanek mentioned this pull request Jan 2, 2024
Possible heap-use-after-free in ctypes in Python 3.12 #113576
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@ericsnowcurrently ericsnowcurrently

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@ericsnowcurrently @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.