-
-
Notifications
You must be signed in to change notification settings - Fork 34.7k
use mimalloc as raw memory allocator in free-threading #144914
Copy link
Copy link
Closed
Labels
3.15pre-release feature fixes, bugs and security fixespre-release feature fixes, bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagePerformance or resource usagetopic-free-threadingtype-featureA feature request or enhancementA feature request or enhancement
Metadata
Metadata
Assignees
Labels
3.15pre-release feature fixes, bugs and security fixespre-release feature fixes, bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagePerformance or resource usagetopic-free-threadingtype-featureA feature request or enhancementA feature request or enhancement
Fields
Give feedbackNo fields configured for issues without a type.
This came up in context of numpy/numpy#30494.
Currently the raw allocator (
PyMem_RawMallocand friends) uses the system allocator because it should be possible to call these APIs without an active thread state. pymalloc requires an active thread state hence that cannot be used, however on free-threading we can instead use mimalloc instead of directly calling the system allocator.Using mimalloc instead of system allocator I see much less contention while freeing the memory on macos, see the benchmark on the numpy issue on how to reproduce the issue.
Linked PRs
mimallocfor raw allocations on free-threading #144916