Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Isolate the Default Object Allocator between Interpreters #101659

Copy link
Copy link
Closed
@ericsnowcurrently

Description

@ericsnowcurrently
Issue body actions

(see gh-100227)

By default, the allocator for the "object" and "mem" domains is historically known as "obmalloc". The implementation of the allocator is _PyObject_Malloc(), etc., for which the runtime state is found in _PyRuntimeState.obmalloc. Thus all interpreters currently share the runtime state for the default allocator.

Isolating that state to each interpreter is important for a per-interpreter GIL (my short-term motivation here), but there are other benefits. For example, it helps us manage resources (e.g. objects) relative to the lifecycle of each interpreter, and to do so more efficiently. Furthermore, any situation where we share memory between interpreters is an invitation for memory leaks and other bugs.

The solution here should be as simple as moving the "obmalloc" state to PyInterpreterState.

Linked PRs

Metadata

Metadata

Labels

Projects

Status

Done
Show more project fields

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.