Skip to content

Upgrade mimalloc to 2.2.2 and adjust static_crt flag on Windows #6

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions libmimalloc-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ fn main() {
cmake_config.define("MI_SKIP_COLLECT_ON_EXIT", "ON");
}

if target_os == "windows" {
mimalloc_base_name = Cow::Owned(format!("{}-static", mimalloc_base_name));
}

if env::var_os("CARGO_FEATURE_SECURE").is_some() {
cmake_config.define("MI_SECURE", "ON");
mimalloc_base_name = Cow::Owned(format!("{}-secure", mimalloc_base_name));
Expand All @@ -51,7 +47,14 @@ fn main() {
}

if target_env == "musl" {
cmake_config.define("MI_LIBC_MUSL", "1");
cmake_config
.define("MI_LIBC_MUSL", "ON")
.cflag("-Wno-error=date-time");
if target_arch == "aarch64" {
cmake_config
.define("MI_OPT_ARCH", "OFF")
.define("MI_NO_OPT_ARCH", "ON");
}
}

let dynamic_tls = env::var("CARGO_FEATURE_LOCAL_DYNAMIC_TLS").is_ok();
Expand All @@ -76,19 +79,14 @@ fn main() {
cmake_config.define("MI_DEBUG_FULL", "OFF");
}

if target_arch == "aarch64" && target_env == "musl" {
cmake_config.define("MI_OPT_ARCH", "OFF");
}

if target_env == "msvc" {
cmake_config
.define("MI_USE_CXX", "ON")
.define("MI_WIN_USE_FIXED_TLS", "ON")
// always turn off debug full and show errors on msvc
.define("MI_DEBUG_FULL", "OFF")
.define("MI_SHOW_ERRORS", "OFF")
.profile("release")
.static_crt(true);
.static_crt(false);
}

let dst = cmake_config.build();
Expand Down
2 changes: 1 addition & 1 deletion libmimalloc-sys/c_src/mimalloc
Submodule mimalloc updated 66 files
+3 −0 .gitignore
+145 −75 CMakeLists.txt
+0 −43 azure-pipelines.yml
+ bin/mimalloc-redirect-arm64.dll
+ bin/mimalloc-redirect-arm64.lib
+ bin/mimalloc-redirect-arm64ec.dll
+ bin/mimalloc-redirect-arm64ec.lib
+ bin/mimalloc-redirect.dll
+ bin/mimalloc-redirect.lib
+ bin/mimalloc-redirect32.dll
+ bin/mimalloc-redirect32.lib
+ bin/minject-arm64.exe
+ bin/minject.exe
+ bin/minject32.exe
+22 −6 bin/readme.md
+2 −2 cmake/mimalloc-config-version.cmake
+0 −0 contrib/docker/alpine-arm32v7/Dockerfile
+0 −0 contrib/docker/alpine/Dockerfile
+0 −0 contrib/docker/manylinux-x64/Dockerfile
+0 −0 contrib/docker/readme.md
+63 −0 contrib/vcpkg/portfile.cmake
+40 −0 contrib/vcpkg/readme.md
+20 −0 contrib/vcpkg/usage
+20 −0 contrib/vcpkg/vcpkg-cmake-wrapper.cmake
+45 −0 contrib/vcpkg/vcpkg.json
+18 −12 ide/vs2022/mimalloc-lib.vcxproj
+6 −3 ide/vs2022/mimalloc-lib.vcxproj.filters
+25 −8 ide/vs2022/mimalloc-override-dll.vcxproj
+6 −8 ide/vs2022/mimalloc-override-dll.vcxproj.filters
+355 −0 ide/vs2022/mimalloc-override-test-dep.vcxproj
+6 −0 ide/vs2022/mimalloc-override-test.vcxproj
+3 −0 ide/vs2022/mimalloc-test-api.vcxproj
+3 −0 ide/vs2022/mimalloc-test-stress.vcxproj
+3 −0 ide/vs2022/mimalloc-test.vcxproj
+20 −2 ide/vs2022/mimalloc.sln
+103 −0 include/mimalloc-stats.h
+22 −15 include/mimalloc.h
+23 −16 include/mimalloc/atomic.h
+38 −37 include/mimalloc/internal.h
+9 −9 include/mimalloc/prim.h
+64 −111 include/mimalloc/types.h
+4 −4 mimalloc.pc.in
+40 −26 readme.md
+1 −1 src/alloc-aligned.c
+9 −9 src/alloc.c
+19 −12 src/arena.c
+5 −6 src/bitmap.c
+7 −7 src/free.c
+16 −10 src/heap.c
+32 −34 src/init.c
+13 −11 src/libc.c
+52 −6 src/options.c
+6 −6 src/os.c
+29 −29 src/page-queue.c
+39 −19 src/page.c
+13 −3 src/prim/unix/prim.c
+19 −11 src/prim/windows/prim.c
+8 −2 src/segment-map.c
+4 −3 src/segment.c
+215 −111 src/stats.c
+7 −5 test/CMakeLists.txt
+15 −0 test/main-override-dep.cpp
+11 −0 test/main-override-dep.h
+25 −17 test/main-override-static.c
+22 −7 test/main-override.cpp
+27 −9 test/test-stress.c
47 changes: 46 additions & 1 deletion libmimalloc-sys/src/extended.rs
Original file line number Diff line number Diff line change
Expand Up @@ -545,8 +545,53 @@ pub const mi_option_max_warnings: mi_option_t = 20;
/// Option (experimental)
pub const mi_option_max_segment_reclaim: mi_option_t = 21;

/// Option (experimental)
pub const mi_option_destroy_on_exit: mi_option_t = 22;

/// Option (experimental)
pub const mi_option_arena_reserve: mi_option_t = 23;

/// Option (experimental)
pub const mi_option_arena_purge_mult: mi_option_t = 24;

/// Option (experimental)
pub const mi_option_purge_extend_delay: mi_option_t = 25;

/// Option (experimental)
pub const mi_option_abandoned_reclaim_on_free: mi_option_t = 26;

/// Option (experimental)
pub const mi_option_disallow_arena_alloc: mi_option_t = 27;

/// Option (experimental)
pub const mi_option_retry_on_oom: mi_option_t = 28;

/// Option (experimental)
pub const mi_option_visit_abandoned: mi_option_t = 29;

/// Option (experimental)
pub const mi_option_guarded_min: mi_option_t = 30;

/// Option (experimental)
pub const mi_option_guarded_max: mi_option_t = 31;

/// Option (experimental)
pub const mi_option_guarded_precise: mi_option_t = 32;

/// Option (experimental)
pub const mi_option_guarded_sample_rate: mi_option_t = 33;

/// Option (experimental)
pub const mi_option_guarded_sample_seed: mi_option_t = 34;

/// Option (experimental)
pub const mi_option_target_segments_per_thread: mi_option_t = 35;

/// Option (experimental)
pub const mi_option_generic_collect: mi_option_t = 36;

/// Last option.
pub const _mi_option_last: mi_option_t = 36;
pub const _mi_option_last: mi_option_t = 37;

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