Skip to content

Commit 907ac8b

Browse files
committed
Upgrade mimalloc to 2.2.2 and adjust static_crt flag on Windows
1 parent 1c96182 commit 907ac8b

File tree

3 files changed

+59
-12
lines changed

3 files changed

+59
-12
lines changed

libmimalloc-sys/build.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ fn main() {
2929
cmake_config.define("MI_SKIP_COLLECT_ON_EXIT", "ON");
3030
}
3131

32-
if target_os == "windows" {
33-
mimalloc_base_name = Cow::Owned(format!("{}-static", mimalloc_base_name));
34-
}
35-
3632
if env::var_os("CARGO_FEATURE_SECURE").is_some() {
3733
cmake_config.define("MI_SECURE", "ON");
3834
mimalloc_base_name = Cow::Owned(format!("{}-secure", mimalloc_base_name));
@@ -52,6 +48,17 @@ fn main() {
5248

5349
if target_env == "musl" {
5450
cmake_config.define("MI_LIBC_MUSL", "1");
51+
match target_arch.as_str() {
52+
"aarch64" => {
53+
cmake_config
54+
.define("MI_OPT_ARCH", "OFF")
55+
.define("MI_NO_OPT_ARCH", "ON");
56+
}
57+
"x86_64" => {
58+
cmake_config.cflag("-Wno-error=date-time");
59+
}
60+
_ => {}
61+
}
5562
}
5663

5764
let dynamic_tls = env::var("CARGO_FEATURE_LOCAL_DYNAMIC_TLS").is_ok();
@@ -76,19 +83,14 @@ fn main() {
7683
cmake_config.define("MI_DEBUG_FULL", "OFF");
7784
}
7885

79-
if target_arch == "aarch64" && target_env == "musl" {
80-
cmake_config.define("MI_OPT_ARCH", "OFF");
81-
}
82-
8386
if target_env == "msvc" {
8487
cmake_config
8588
.define("MI_USE_CXX", "ON")
86-
.define("MI_WIN_USE_FIXED_TLS", "ON")
8789
// always turn off debug full and show errors on msvc
8890
.define("MI_DEBUG_FULL", "OFF")
8991
.define("MI_SHOW_ERRORS", "OFF")
9092
.profile("release")
91-
.static_crt(true);
93+
.static_crt(false);
9294
}
9395

9496
let dst = cmake_config.build();

libmimalloc-sys/c_src/mimalloc

Submodule mimalloc updated 66 files

libmimalloc-sys/src/extended.rs

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,8 +545,53 @@ pub const mi_option_max_warnings: mi_option_t = 20;
545545
/// Option (experimental)
546546
pub const mi_option_max_segment_reclaim: mi_option_t = 21;
547547

548+
/// Option (experimental)
549+
pub const mi_option_destroy_on_exit: mi_option_t = 22;
550+
551+
/// Option (experimental)
552+
pub const mi_option_arena_reserve: mi_option_t = 23;
553+
554+
/// Option (experimental)
555+
pub const mi_option_arena_purge_mult: mi_option_t = 24;
556+
557+
/// Option (experimental)
558+
pub const mi_option_purge_extend_delay: mi_option_t = 25;
559+
560+
/// Option (experimental)
561+
pub const mi_option_abandoned_reclaim_on_free: mi_option_t = 26;
562+
563+
/// Option (experimental)
564+
pub const mi_option_disallow_arena_alloc: mi_option_t = 27;
565+
566+
/// Option (experimental)
567+
pub const mi_option_retry_on_oom: mi_option_t = 28;
568+
569+
/// Option (experimental)
570+
pub const mi_option_visit_abandoned: mi_option_t = 29;
571+
572+
/// Option (experimental)
573+
pub const mi_option_guarded_min: mi_option_t = 30;
574+
575+
/// Option (experimental)
576+
pub const mi_option_guarded_max: mi_option_t = 31;
577+
578+
/// Option (experimental)
579+
pub const mi_option_guarded_precise: mi_option_t = 32;
580+
581+
/// Option (experimental)
582+
pub const mi_option_guarded_sample_rate: mi_option_t = 33;
583+
584+
/// Option (experimental)
585+
pub const mi_option_guarded_sample_seed: mi_option_t = 34;
586+
587+
/// Option (experimental)
588+
pub const mi_option_target_segments_per_thread: mi_option_t = 35;
589+
590+
/// Option (experimental)
591+
pub const mi_option_generic_collect: mi_option_t = 36;
592+
548593
/// Last option.
549-
pub const _mi_option_last: mi_option_t = 36;
594+
pub const _mi_option_last: mi_option_t = 37;
550595

551596
extern "C" {
552597
// Note: mi_option_{enable,disable} aren't exposed because they're redundant

0 commit comments

Comments
 (0)