Skip to content

ENH: use PyMem_RawMalloc instead of system allocator for better performance on free-threading (#31503)#31531

Merged
charris merged 1 commit into
numpy:maintenance/2.5.xfrom
charris:backport-31503
May 28, 2026
Merged

ENH: use PyMem_RawMalloc instead of system allocator for better performance on free-threading (#31503)#31531
charris merged 1 commit into
numpy:maintenance/2.5.xfrom
charris:backport-31503

Conversation

@charris
Copy link
Copy Markdown
Member

@charris charris commented May 28, 2026

Backport of #31503.

PR summary

Fixes #28454

This PR replaces usage of system allocator malloc with PyMem_RawMalloc and friends for better performance on free-threading where mimalloc is used as the underlying allocator.

AI Disclosure

I used Claude to find all the places where the replacement makes sense.

@charris charris added this to the 2.5.0 Release milestone May 28, 2026
@charris charris added 01 - Enhancement 08 - Backport Used to tag backport PRs 39 - free-threading PRs and issues related to support for free-threading CPython (a.k.a. no-GIL, PEP 703) labels May 28, 2026
@charris charris merged commit d2d2aa2 into numpy:maintenance/2.5.x May 28, 2026
85 checks passed
@charris charris deleted the backport-31503 branch May 28, 2026 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

01 - Enhancement 08 - Backport Used to tag backport PRs 39 - free-threading PRs and issues related to support for free-threading CPython (a.k.a. no-GIL, PEP 703)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants