Skip to content

Memray needs to be thread-safe to run under free-threading #772

@ZeroIntensity

Description

@ZeroIntensity

Is there an existing proposal for this?

  • I have searched the existing proposals

Is your feature request related to a problem?

Memray exposes a programmatic API for profiling, which needs to be thread-safe in order to run under free-threaded builds of Python.

Describe the solution you'd like

I don't think we need to worry about scaling too much. Critical sections should definitely work for Cython code, especially since they now have free-threading support.

For Memray's C++ code, critical sections probably won't work (because a lot of global state isn't owned by objects), so some global PyMutex locks will probably end up being the best choice.

I'll begin working on this sometime soon.

Alternatives you considered

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions