From 71b8809a6563d9bbeef9ceb8e3997e37f0a387ae Mon Sep 17 00:00:00 2001 From: Evan Cameron Date: Wed, 4 Mar 2026 16:15:01 -0500 Subject: [PATCH 1/8] change name to bc-mimalloc --- Cargo.toml | 8 ++++---- libmimalloc-sys/Cargo.toml | 6 +++--- libmimalloc-sys/sys-test/Cargo.toml | 2 +- test-override-with-dylib/Cargo.toml | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4aee4be..ec4d3a4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "mimalloc" +name = "bc-mimalloc" version = "0.1.48" authors = [ "Octavian Oncescu ", @@ -7,10 +7,10 @@ authors = [ "Thom Chiovoloni ", ] edition = "2018" -repository = "https://github.com/purpleprotocol/mimalloc_rust" +repository = "https://github.com/leshow/mimalloc_rust" keywords = ["mimalloc", "allocator", "encrypted-heap", "performance"] categories = ["memory-management", "api-bindings"] -description = "Performance and security oriented drop-in allocator" +description = "Performance and security oriented drop-in allocator (updated to v2.2.7 and v3.2.8, respectively)" license = "MIT" readme = "README.md" @@ -25,7 +25,7 @@ members = [ travis-ci = { repository = "purpleprotocol/mimalloc_rust" } [dependencies] -libmimalloc-sys = { path = "libmimalloc-sys", version = "0.1.44", default-features = false } +libmimalloc-sys = { package = "bc-libmimalloc-sys", path = "libmimalloc-sys", version = "0.1.44", default-features = false } [features] default = [] diff --git a/libmimalloc-sys/Cargo.toml b/libmimalloc-sys/Cargo.toml index 67eeb4c..fde9b70 100644 --- a/libmimalloc-sys/Cargo.toml +++ b/libmimalloc-sys/Cargo.toml @@ -1,12 +1,12 @@ [package] -name = "libmimalloc-sys" +name = "bc-libmimalloc-sys" version = "0.1.44" authors = ["Octavian Oncescu "] edition = "2018" -repository = "https://github.com/purpleprotocol/mimalloc_rust/tree/master/libmimalloc-sys" +repository = "https://github.com/leshow/mimalloc_rust/tree/master/libmimalloc-sys" keywords = ["allocator", "encrypted-heap", "performance"] categories = ["memory-management", "api-bindings"] -description = "Sys crate wrapping the mimalloc allocator" +description = "Sys crate wrapping the mimalloc allocator (updated to v2.2.7 and v3.2.8, respectively)" license = "MIT" links = "mimalloc" exclude = [ diff --git a/libmimalloc-sys/sys-test/Cargo.toml b/libmimalloc-sys/sys-test/Cargo.toml index 5148cec..c117808 100644 --- a/libmimalloc-sys/sys-test/Cargo.toml +++ b/libmimalloc-sys/sys-test/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT" publish = false [dependencies] -libmimalloc-sys = { path = ".." } +libmimalloc-sys = { package = "bc-libmimalloc-sys", path = ".." } libc = "0.2" [build-dependencies] diff --git a/test-override-with-dylib/Cargo.toml b/test-override-with-dylib/Cargo.toml index c1381fc..1b3f9ed 100644 --- a/test-override-with-dylib/Cargo.toml +++ b/test-override-with-dylib/Cargo.toml @@ -8,7 +8,7 @@ publish = false [dependencies] libc = { version = "^0.2.8", default-features = false } -libmimalloc-sys = { path = "../libmimalloc-sys" } +libmimalloc-sys = { package = "bc-libmimalloc-sys", path = "../libmimalloc-sys" } [build-dependencies] cc = "^1.0.13" From 98f45d59b853db9502ca55285ac275bcce57e7a2 Mon Sep 17 00:00:00 2001 From: Evan Cameron Date: Wed, 4 Mar 2026 16:26:10 -0500 Subject: [PATCH 2/8] bc-libmimalloc-sys --- .github/workflows/ci.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bc2ab8a..f51e623 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,7 @@ on: pull_request: # Run daily to catch when Rust updates cause problems to happen. schedule: - - cron: '00 01 * * *' + - cron: "00 01 * * *" jobs: rust: @@ -115,7 +115,6 @@ jobs: name: Check documentation runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 with: submodules: recursive @@ -127,8 +126,8 @@ jobs: # gets us the nicer syntax for linking to functions, and is in-line with # what docs.rs uses. - - name: 'Check documentation links in `mimalloc`' + - name: "Check documentation links in `mimalloc`' run: cargo rustdoc -- -D warnings - - name: 'Check documentation links in `libmimalloc-sys`' - run: cargo rustdoc -p libmimalloc-sys -- -D warnings + - name: 'Check documentation links in `bc-libmimalloc-sys`' + run: cargo rustdoc -p bc-libmimalloc-sys -- -D warnings From df231c8ccb46259cad36756bfc33690df4be79a2 Mon Sep 17 00:00:00 2001 From: Evan Cameron Date: Wed, 4 Mar 2026 16:27:20 -0500 Subject: [PATCH 3/8] fix ci.yml: fix mismatched quote causing invalid YAML --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f51e623..adffcf6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -126,8 +126,8 @@ jobs: # gets us the nicer syntax for linking to functions, and is in-line with # what docs.rs uses. - - name: "Check documentation links in `mimalloc`' + - name: "Check documentation links in `mimalloc`" run: cargo rustdoc -- -D warnings - - name: 'Check documentation links in `bc-libmimalloc-sys`' + - name: "Check documentation links in `bc-libmimalloc-sys`" run: cargo rustdoc -p bc-libmimalloc-sys -- -D warnings From 1936c8b3e85de283f205744a68585c3a4355c54d Mon Sep 17 00:00:00 2001 From: Evan Cameron Date: Wed, 4 Mar 2026 16:44:27 -0500 Subject: [PATCH 4/8] fix extended build --- libmimalloc-sys/src/extended.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/libmimalloc-sys/src/extended.rs b/libmimalloc-sys/src/extended.rs index 4fa966e..5180170 100644 --- a/libmimalloc-sys/src/extended.rs +++ b/libmimalloc-sys/src/extended.rs @@ -525,6 +525,9 @@ pub const mi_option_reserve_huge_os_pages_at: mi_option_t = 8; pub const mi_option_reserve_os_memory: mi_option_t = 9; /// Option (experimental) the first N segments per thread are not eagerly committed (=1). +/// +/// Note: removed/renamed in v3 (`mi_option_deprecated_eager_commit_delay`). +#[cfg(not(feature = "v3"))] pub const mi_option_eager_commit_delay: mi_option_t = 14; /// Option (experimental) Pretend there are at most N NUMA nodes; Use 0 to use the actual detected NUMA nodes at runtime. @@ -965,12 +968,34 @@ extern "C" { /// Returns `true` if all areas and blocks were visited. /// /// Passing a `None` visitor is allowed, and is a no-op. + #[cfg(not(feature = "v3"))] pub fn mi_heap_visit_blocks( heap: *const mi_heap_t, visit_all_blocks: bool, visitor: mi_block_visit_fun, arg: *mut c_void, ) -> bool; + /// Visit all areas and blocks in `heap`. + /// + /// If `visit_all_blocks` is false, the `visitor` is only called once for + /// every heap area. If it's true, the `visitor` is also called for every + /// allocated block inside every area (with `!block.is_null()`). Return + /// `false` from the `visitor` to return early. + /// + /// `arg` is an extra argument passed into the `visitor`. + /// + /// Returns `true` if all areas and blocks were visited. + /// + /// Passing a `None` visitor is allowed, and is a no-op. + /// + /// Note: in v3 the `heap` parameter is non-const compared to v2. + #[cfg(feature = "v3")] + pub fn mi_heap_visit_blocks( + heap: *mut mi_heap_t, + visit_all_blocks: bool, + visitor: mi_block_visit_fun, + arg: *mut c_void, + ) -> bool; #[cfg(feature = "arena")] /// Create a heap that only allocates in the specified arena From 51fa6b1e521ef67d60390094379a269a4ca3aff7 Mon Sep 17 00:00:00 2001 From: Evan Cameron Date: Wed, 4 Mar 2026 16:45:56 -0500 Subject: [PATCH 5/8] fix clippy lints --- libmimalloc-sys/build.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libmimalloc-sys/build.rs b/libmimalloc-sys/build.rs index c67e6d6..c32eb3e 100644 --- a/libmimalloc-sys/build.rs +++ b/libmimalloc-sys/build.rs @@ -89,7 +89,7 @@ fn main() { // For instance, on certain platforms, llvm has relocated the atomic of the arm32 architecture to libclang_rt.builtins.a // while some use libatomic.a, and others use libatomic_ops.a. let atomic_name = env::var("DEP_ATOMIC").unwrap_or("atomic".to_owned()); - println!("cargo:rustc-link-lib={}", atomic_name); + println!("cargo:rustc-link-lib={atomic_name}"); } // Link with libs needed on Windows @@ -98,7 +98,7 @@ fn main() { let libs = ["psapi", "shell32", "user32", "advapi32", "bcrypt"]; for lib in libs { - println!("cargo:rustc-link-lib={}", lib); + println!("cargo:rustc-link-lib={lib}"); } } } From 4b41823755e82bdcbffaca20f1df1f568a696624 Mon Sep 17 00:00:00 2001 From: Evan Cameron Date: Wed, 4 Mar 2026 16:49:13 -0500 Subject: [PATCH 6/8] fix divergence in v3 --- libmimalloc-sys/sys-test/build.rs | 2 +- libmimalloc-sys/sys-test/src/main.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libmimalloc-sys/sys-test/build.rs b/libmimalloc-sys/sys-test/build.rs index 383f0dc..9b749fc 100644 --- a/libmimalloc-sys/sys-test/build.rs +++ b/libmimalloc-sys/sys-test/build.rs @@ -49,7 +49,7 @@ fn main() { // and then uses `mi_some_fun *arg` as argument types, which // appears to upset ctest, which would prefer function pointers // be declared as pointers, so we clean things up for it. - t if t.ends_with("_fun") => format!("{}*", t), + t if t.ends_with("_fun") => format!("{t}*"), t => t.to_string(), } diff --git a/libmimalloc-sys/sys-test/src/main.rs b/libmimalloc-sys/sys-test/src/main.rs index 385a34d..821f75d 100644 --- a/libmimalloc-sys/sys-test/src/main.rs +++ b/libmimalloc-sys/sys-test/src/main.rs @@ -1,4 +1,4 @@ -#![allow(bad_style, unused_imports, unused_macros, clippy::all)] +#![allow(bad_style, unused_imports, unused_macros, clippy::all, function_casts_as_integer)] use libmimalloc_sys::*; From fc6424244bfb3a859a5a519028f7f05558d78b2f Mon Sep 17 00:00:00 2001 From: Evan Cameron Date: Wed, 4 Mar 2026 16:50:20 -0500 Subject: [PATCH 7/8] fmt --- libmimalloc-sys/sys-test/src/main.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libmimalloc-sys/sys-test/src/main.rs b/libmimalloc-sys/sys-test/src/main.rs index 821f75d..9c237ee 100644 --- a/libmimalloc-sys/sys-test/src/main.rs +++ b/libmimalloc-sys/sys-test/src/main.rs @@ -1,4 +1,10 @@ -#![allow(bad_style, unused_imports, unused_macros, clippy::all, function_casts_as_integer)] +#![allow( + bad_style, + unused_imports, + unused_macros, + clippy::all, + function_casts_as_integer +)] use libmimalloc_sys::*; From c7eba6b45436533260470fc3e04dcedca4662c8a Mon Sep 17 00:00:00 2001 From: Evan Cameron Date: Wed, 4 Mar 2026 16:56:42 -0500 Subject: [PATCH 8/8] gate mi_stats_merge --- libmimalloc-sys/src/extended.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libmimalloc-sys/src/extended.rs b/libmimalloc-sys/src/extended.rs index 5180170..5c4b204 100644 --- a/libmimalloc-sys/src/extended.rs +++ b/libmimalloc-sys/src/extended.rs @@ -314,6 +314,9 @@ extern "C" { /// Merge thread local statistics with the main statistics and reset. /// /// Note: This function is thread safe. + /// + /// Note: not available in v3 (declared in header but not implemented). + #[cfg(not(feature = "v3"))] pub fn mi_stats_merge(); /// Return the mimalloc version number.