-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use mimalloc as the global allocator on x86_64-pc-windows-msvc
#138764
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,6 +70,10 @@ use time::OffsetDateTime; | |
use time::macros::format_description; | ||
use tracing::trace; | ||
|
||
#[cfg(feature = "mimalloc")] | ||
#[global_allocator] | ||
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this just temporary, or the long-term state? As-is this doesn't affect LLVM's malloc calls? IOW, why is this not changign the rustc/src/main.rs malloc overrides? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Long term. It's better than the linker hacks in main.rs. Overriding the C allocator only in main.rs doesn't affect DLLs making it unsound without further work dealing with loadable backends and LLVM plugins. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But isn't this still a regression for LLVM's allocations? It seems odd to measure perf for a halfway shift like this to mimalloc... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We'd still want the linker hacks on Linux / macOS for LLVM, using As for perf on this PR, LLVM uses Windows' heap allocator both before and after. |
||
|
||
#[allow(unused_macros)] | ||
macro do_not_use_print($($t:tt)*) { | ||
std::compile_error!( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we reject setting both? That feels needlessly confusing to me and probably not hugely needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can probably just remove jemalloc if mimalloc v3 solves all regressions over it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe name this field
override-allocators
in case we'd want to swap allocators in the future?